You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a application which I want to run selenium tests (JUnit 4). I start the application it's database and a elastic search service with a docker compose file. I also start a chrome or firefox browser container depending on a setting. For my first test class this works perfectly but after that the compose services getting restarted. This isn't a problem but it results in socat trying to connect to the application itself right direct after the application container begone to start without waiting for the service to be healthy. Because the application needs a couple of minutes to start the exposed port isn't available and socat fails like this:
ERROR 🐳 [alpine/socat:latest]:485 - Could not start container
org.testcontainers.containers.ContainerLaunchException: Aborting attempt to link to container 1h6gja65n7j4_anwendung_1 as it is not running
at org.testcontainers.containers.GenericContainer.applyConfiguration(GenericContainer.java:777) ~[testcontainers-1.14.3.jar:?]
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:359) ~[testcontainers-1.14.3.jar:?]
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:325) ~[testcontainers-1.14.3.jar:?]
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81) [duct-tape-1.0.8.jar:?]
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:323) [testcontainers-1.14.3.jar:?]
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:311) [testcontainers-1.14.3.jar:?]
at org.testcontainers.containers.DockerComposeContainer.startAmbassadorContainers(DockerComposeContainer.java:298) [testcontainers-1.14.3.jar:?]
at org.testcontainers.containers.DockerComposeContainer.start(DockerComposeContainer.java:172) [testcontainers-1.14.3.jar:?]
at org.testcontainers.containers.DockerComposeContainer.starting(DockerComposeContainer.java:141) [testcontainers-1.14.3.jar:?]
at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29) [testcontainers-1.14.3.jar:?]
at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner.run(ParentRunner.java:413) [junit-4.13.jar:4.13]
at org.junit.runners.Suite.runChild(Suite.java:128) [junit-4.13.jar:4.13]
at org.junit.runners.Suite.runChild(Suite.java:27) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.jar:4.13]
at org.junit.runners.ParentRunner.run(ParentRunner.java:413) [junit-4.13.jar:4.13]
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) [surefire-junit4-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) [surefire-booter-2.22.2.jar:2.22.2]
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) [surefire-booter-2.22.2.jar:2.22.2]
Since I am not allowed to post the whole code, here is an excerpt with the most important:
Let me know if you need more information or if I can help.
The text was updated successfully, but these errors were encountered:
Nicklas2751
changed the title
Socat failes after first testclass because it don'
Socat failes after first testclass because it don't waits for docker compose service to be healthy
Jul 8, 2020
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this.
Hey @Nicklas2751,
the example project does indeed reproduce the issue for me. There might to be a problem with the DockerComposeContainer object not correctly cleaning up its previous state on stop.
I have a application which I want to run selenium tests (JUnit 4). I start the application it's database and a elastic search service with a docker compose file. I also start a chrome or firefox browser container depending on a setting. For my first test class this works perfectly but after that the compose services getting restarted. This isn't a problem but it results in socat trying to connect to the application itself right direct after the application container begone to start without waiting for the service to be healthy. Because the application needs a couple of minutes to start the exposed port isn't available and socat fails like this:
Since I am not allowed to post the whole code, here is an excerpt with the most important:
My docker compose file looks like this:
And this are the dependencies I am using:
I run it with
./mvnw clean test -Pchrome,BasicTestSuite
My docker version:
And docker compose:
Java version:
I have managed to reproduce the problem in a sample project: https://github.com/Nicklas2751/testcontainers-issue-example
To run it and reproduce the problem:
./mvnw clean test -Pchrome,BasicTestSuite
Let me know if you need more information or if I can help.
The text was updated successfully, but these errors were encountered: