After upgrade to 1.16.1 JUnit tests fail on AWS CodeBuild
See original GitHub issueWhen upgrading to 1.16.1, tests using TestContainers start to fail when executed on AWS CodeBuild. Locally they still run successfully. With 1.16.0 they still run successfully.
Here is the stack trace:
Creating container for image: amazon/dynamodb-local:1.15.0
Starting container with ID: cd71e434635d54dc183620bc887d2413bd53184031832709a61fa4c0de4d20f3
Container amazon/dynamodb-local:1.15.0 is starting: cd71e434635d54dc183620bc887d2413bd53184031832709a61fa4c0de4d20f3
Could not start container
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (172.18.0.1 ports: [32768] should be listening)
at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:89)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:51)
at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:929)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:468)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:331)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317)
As a workaround, I added the environment variable TESTCONTAINERS_HOST_OVERRIDE=127.0.0.1
. Then the tests pass successfully again.
So it seems that an “external” IP is used for the docker host instead of localhost.
Do you know what changed with detection of the environment that might cause this issue?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Troubleshooting AWS CodeBuild
Provides troubleshooting information for AWS CodeBuild. ... Issue: When you try to update a project in the console, the update failed with this...
Read more >Working with test reporting in AWS CodeBuild
You can create reports in CodeBuild that contain details about tests that are run during builds. You can create tests such as unit...
Read more >Test Reports with AWS CodeBuild | AWS DevOps Blog
The following sample buildspec.yml file generates test reports from JUnit tests using Surefire and stores it in the Report Group named ...
Read more >Create a test report in CodeBuild using the AWS CLI sample
You specify the location of your test files in the buildspec file. The following test report file formats are supported: Cucumber JSON (.json)....
Read more >Specify test commands - AWS CodeBuild
The following is a sample commands section that includes commands to run the tests in ... commands: - echo Running tests for surefire...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rnorth I re-ran our build job with the following dependencies (via JitPack):
com.github.testcontainers.testcontainers-java:testcontainers:e257baca07
com.github.testcontainers.testcontainers-java:junit-jupiter:e257baca07
com.github.testcontainers.testcontainers-java:postgresql:e257baca07
com.github.testcontainers.testcontainers-java:kafka:e257baca07
com.github.testcontainers.testcontainers-java:selenium:e257baca07
The tests succeeded this time. Here’s the debug output for the successful run: testcontainers-debug.txt
Fixed by #4597, thanks to everyone helping in debugging this! 🙇