testcontainers / testcontainers/testcontainers-java
Display name for GenericContainer
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
When using regular containers, the image name is usually sufficient for identifying which container given log line is about.
However, when using 2+ GenericContainer instances with same image, it's no longer so:
2020-01-13T13:32:45.298+0100 INFO testcontainers-lifecycle-2 🐳 [centos:7] Creating container for image: centos:7
2020-01-13T13:32:45.297+0100 INFO testcontainers-lifecycle-1 🐳 [centos:7] Creating container for image: centos:7
2020-01-13T13:32:45.297+0100 INFO testcontainers-lifecycle-0 🐳 [centos:7] Creating container for image: centos:7
...
2020-01-13T13:37:46.946+0100 ERROR testcontainers-lifecycle-1 🐳 [centos:7] Could not start container
java.lang.IllegalStateException: Container exited with code 1
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:457)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:317)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:315)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:302)
at java.util.concurrent.CompletableFuture.uniRun(CompletableFuture.java:705)
at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:687)
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Neither the log line, nor the exception provide information which container failed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at GenericContainer.tryStart and GenericContainer.doStart, which appear in the reported stack trace, and inspect how the container image is used in lifecycle log messages. Done means logs and startup failures distinguish multiple GenericContainer instances created from the same image; add or update focused tests for that behavior if the existing test location is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100