Add lifecycle hooks that do not need a subclass
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- docker, node.js, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.6k
- Forks
- 274
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 44
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de testcontainers/testcontainers-node
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
testcontainers/testcontainers-node#1539 ·
Los mantenedores suelen responder en 1 día
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
testcontainers/testcontainers-node#1533 ·
Los mantenedores suelen responder en 1 día
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
testcontainers/testcontainers-node#1531 ·
Los mantenedores suelen responder en 1 día
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
testcontainers/testcontainers-node#1529 ·
Los mantenedores suelen responder en 1 día
-
enhancement minor
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
testcontainers/testcontainers-node#1528 ·
Los mantenedores suelen responder en 1 día
Todos los issues de testcontainers/testcontainers-node
Issues similares
-
ui(ListToolbar): search takes the full row on a phone instead of sharing it with the result countAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
priority:high
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
immich-app/immich#32426 ·
Los mantenedores suelen responder en 1 día
-
documentation good first issue hacktoberfest help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
libredb/libredb-studio#1756 ·
Los mantenedores suelen responder en 1 día