testcontainers / testcontainers/testcontainers-java
DockerComposeContainer - InvalidExitException stack trace and cause hidden
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 8.7k
- Fork
- 1.9k
- Merge medio
- 2g 17h
- PR unite (30g)
- 9
Descrizione
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);
}
Guida per i contributori
Apri 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.
Direzione di ricerca
Inizia in core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java alle righe 771-775, dove InvalidExitValueException viene convertita in ContainerLaunchException. Esegui i test Docker Compose pertinenti e verifica che l'eccezione originale venga conservata come causa quando l'avvio fallisce.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, docker-compose, java
- Ambito
- testing-qa
- Tipo di issue
- Bug
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100