testcontainers / testcontainers/testcontainers-java
DockerComposeContainer - InvalidExitException stack trace and cause hidden
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
While attempting to use the DockerComposeContainer, I was having some difficulty troubleshooting a startup exception, and had to switch to using individual GenericContainer definitions to figure out that the root cause was failure to find an image.
This was made difficult by the fact that InvalidExitExceptions are caught and mapped to a ContainerLaunchException, but without the causing exception being wrapped.
} catch (InvalidExitValueException e) {
throw new ContainerLaunchException("Local Docker Compose exited abnormally with code " +
e.getExitValue() + " whilst running command: " + cmd);
} catch (Exception e) {
throw new ContainerLaunchException("Error running local Docker Compose command: " + cmd, e);
}
Is there a reason that the original exception is not included in the ContainerLaunchException?
I was experiencing this issue only while running a maven build which by default hides logs, and while that could probably be tweaked by config to debug it, it seems like supporting this could be easily improved by simply wrapping the exception like so, the same way it is for generic Exception:
} catch (InvalidExitValueException e) {
throw new ContainerLaunchException("Local Docker Compose exited abnormally with code " +
e.getExitValue() + " whilst running command: " + cmd, e);
} catch (Exception e) {
throw new ContainerLaunchException("Error running local Docker Compose command: " + cmd, e);
}
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.
Línea de trabajo
Comienza en core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java, en las líneas 771-775, donde InvalidExitValueException se convierte en ContainerLaunchException. Ejecuta las pruebas relevantes de Docker Compose y verifica que la excepción original se conserve como causa cuando el inicio falla.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- docker, docker-compose, java
- Área
- testing-qa
- Tipo de issue
- Error
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 35/100