testcontainers / testcontainers/testcontainers-java
DockerComposeContainer - InvalidExitException stack trace and cause hidden
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 8.7k
- Forks
- 1.9k
- Ø Merge
- 2 T. 17 Std.
- Gemergte PRs (30 T.)
- 9
Beschreibung
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);
}
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java in den Zeilen 771-775, wo InvalidExitValueException in ContainerLaunchException umgewandelt wird. Führe die relevanten Docker Compose-Tests aus und überprüfe, dass die ursprüngliche Exception als Ursache erhalten bleibt, wenn der Start fehlschlägt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- docker, docker-compose, java
- Bereich
- testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100