Add lifecycle hooks that do not need a subclass
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- docker, node.js, typescript
Direzione di ricerca
Start with the three files named under “Where,” then read #1520, #1521, and #1582 to understand the dependencies on builder state, reuse behavior, and startup time. Implement registered lifecycle hooks and the startup command shorthand while retaining the protected methods. Done means hooks receive the described context and can be combined; verify behavior for each lifecycle stage and reused containers.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
The lifecycle hooks are protected methods: beforeContainerCreated, containerCreated, containerStarting and containerStarted on GenericContainer, and containerStopping and containerStopped on AbstractStartedContainer. Using one means writing a subclass.
- A hook cannot be added to a module container without subclassing the module.
- Two independent behaviours cannot be combined, because each wants to be the subclass.
- A one-off "run this command once the container is ready" needs a class.
Expected
Hooks can be registered on the builder, and several can be registered:
new PostgreSqlContainer(image).withLifecycleHooks({
started: async (container) => {
await container.exec(["psql", "-f", "/seed.sql"]);
},
});
plus a shorthand for the commonest case, withStartupCommands([...]). The protected methods keep working.
Where
packages/testcontainers/src/generic-container/generic-container.tspackages/testcontainers/src/generic-container/started-generic-container.tspackages/testcontainers/src/test-container.ts
Notes
- Go has
WithLifecycleHooksandWithAdditionalLifecycleHooks, with hooks for each of pre/post create, start, ready, stop and terminate, and the shorthandsWithStartupCommandandWithAfterReadyCommand. - Each hook should be told whether the container was reused.
- Pass hooks one context object instead of more positional arguments. It should carry
reused, the remaining startup time and, later, an abort signal.
Dependencies
- Stack on #1520: registered hooks are builder state, and they run inside the reworked
start(). - Coordinate with #1521: that issue decides when hooks run for a reused container.
- Coordinate with #1582: the hook context carries the remaining startup time.
- Lingua principale
- TypeScript
- Stelle
- 2.6k
- Fork
- 274
- Merge medio
- 1g 14h
- PR unite (30g)
- 44
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di testcontainers/testcontainers-node
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
testcontainers/testcontainers-node#1539 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
testcontainers/testcontainers-node#1533 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
testcontainers/testcontainers-node#1531 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
testcontainers/testcontainers-node#1529 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
testcontainers/testcontainers-node#1528 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di testcontainers/testcontainers-node
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dsh-market/dsh-market#877 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
stellar/stellar-dev-skill#151 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Trial & Error: guided Blind offer squeezes on phones and sits under the touch toolbar on iPadApertaarea:arcade game ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
fderuiter/deruiter.dev#2281 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
scope: data grid type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni