testcontainers / testcontainers/testcontainers-java

Improve logging when withReuse() is specified and a container cannot be reused.

Abierto
#3,013 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Java
Estrellas
8.7k
Forks
1.9k
Merge medio
2 d 17 h
PR fusionados (30 d)
9

Descripción

I would like to see a warning logged everytime a container is started withReuse(true) and the hash does not match.

Ideally the warning should contain details of the existing running containers, their container ids and mismatched hashes.

And if possible it would be REALLY helpful to have some details about why the hash didn't match. I realize from reading the code that this isn't possible currently given that the hash is computed from the CreateContainerCmd but maybe some comparisions would be performed of the InspectContainerResponse post container start, as compared to the existing containers.. It would probably make sense to log this level of detail at DEBUG or TRACE levels.

Right now we are facing issues where it's very easy to trigger new containers to be created when the intent was to reuse an existing container, and it's very easy to miss this happening in the logs unless you are paying special attention to it.

And once you've spotted it, it's very hard to troubleshoot why a new container was created vs an existing one being reused.

Sometimes it's some init-data that was updated so the files hash has changed, othertimes, it's something more subtle like a host bind path having a trailing / but otherwise being exactly the same.. This last issue has other implications, which probably warrants it's own ticket, but at the moment it's hard to gather all the evidence easily.. hence this ticket.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza siguiendo withReuse(true) a través de la ruta de reutilización de contenedores y, después, inspecciona cómo se compara el hash de CreateContainerCmd con los contenedores existentes en ejecución. Revisa los detalles disponibles de InspectContainerResponse y los puntos de logging. Se considera terminado cuando una discrepancia de reutilización emite una advertencia con los IDs de los contenedores y los hashes, con detalles de comparación más profundos en DEBUG o TRACE cuando estén disponibles.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
docker, java
Área
observability, testing
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.