testcontainers / testcontainers/testcontainers-java
Docker compose with Citus images fails to start
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
I run integration tests within a Spring Boot and have a defined docker-compose file: https://github.com/citusdata/docker/blob/master/docker-compose.yml
The DockerComposeContainer config:
final var container = new DockerComposeContainer(dockerComposeFile)
.withLocalCompose(true)
.withExposedService("master", 5432, Wait.forListeningPort())
.withExposedService("manager", 5432, Wait.forLogMessage(STARTUP_MESSAGE_FROM_CONTAINER, 1))
.withExposedService("worker", 5432, Wait.forListeningPort());
container.start();
return container;
So the problem is that after 3-4 test classes starting and shutting down the compose file(the tests execute successfully and everything is fine), I get this error on the next test class.
t.test.mock.mockito.ResetMocksTestExecutionListener@4cd0e037, org.spockframework.spring.SpringMockTestExecutionListener@72af31b2]
2020-08-31 22:34:19.423 INFO 5088 --- [ Test worker] o.t.containers.DockerComposeContainer : Preemptively checking local images for 'citusdata/membership-manager:0.3.0', referenced via a compose file or transitive Dockerfile. If not available, it will be pulled.
2020-08-31 22:34:19.432 INFO 5088 --- [ Test worker] o.t.containers.DockerComposeContainer : Preemptively checking local images for 'citusdata/citus:9.4.0', referenced via a compose file or transitive Dockerfile. If not available, it will be pulled.
2020-08-31 22:34:19.442 INFO 5088 --- [ Test worker] 🐳 [docker-compose] : Local Docker Compose is running command: up -d
2020-08-31 22:34:19.593 INFO 5088 --- [ Thread-13] 🐳 [docker-compose] : Creating network "cbx9ms68ba5j_default" with the default driver
2020-08-31 22:34:19.686 INFO 5088 --- [ Thread-13] 🐳 [docker-compose] : Creating volume "cbx9ms68ba5j_healthcheck-volume" with default driver
2020-08-31 22:34:20.162 INFO 5088 --- [ Thread-13] 🐳 [docker-compose] : Creating cbx9ms68ba5j_master_1 ... done
2020-08-31 22:34:20.164 INFO 5088 --- [ Thread-13] 🐳 [docker-compose] :
2020-08-31 22:34:20.677 INFO 5088 --- [ Thread-13] 🐳 [docker-compose] : Creating cbx9ms68ba5j_manager_1 ... done
2020-08-31 22:34:20.679 INFO 5088 --- [ Thread-13] 🐳 [docker-compose] :
2020-08-31 22:34:21.284 INFO 5088 --- [ Thread-13] 🐳 [docker-compose] : Creating cbx9ms68ba5j_worker_1 ... done
2020-08-31 22:34:21.304 INFO 5088 --- [ Test worker] 🐳 [docker-compose] :
> :users:integrationTest > Executing test com.users.UsersQueryResolverTest
2020-08-31 22:34:21.305 INFO 5088 --- [ Test worker] 🐳 [docker-compose] : Docker Compose has finished running
2020-08-31 22:34:21.305 INFO 5088 --- [ Test worker] 🐳 [alpine/socat:latest] : Creating container for image: alpine/socat:latest
2020-08-31 22:34:21.312 ERROR 5088 --- [ Test worker] 🐳 [alpine/socat:latest] : Could not start container
org.testcontainers.containers.ContainerLaunchException: Aborting attempt to link to container cbx9mskvyfm7_master_1 as it is not running
2020-08-31 22:34:21.313 INFO 5088 --- [ Test worker] 🐳 [docker-compose] : Local Docker Compose is running command: down -v
2020-08-31 22:34:31.914 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] : Stopping cbx9ms68ba5j_worker_1 ... done
2020-08-31 22:34:32.368 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] :
2020-08-31 22:34:32.368 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] : Stopping cbx9ms68ba5j_manager_1 ... done
2020-08-31 22:34:32.848 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] :
2020-08-31 22:34:32.858 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] :
2020-08-31 22:34:32.891 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] : Removing cbx9ms68ba5j_worker_1 ... done
2020-08-31 22:34:32.911 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] : Removing cbx9ms68ba5j_master_1 ... done
2020-08-31 22:34:32.911 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] : Removing network cbx9ms68ba5j_default
2020-08-31 22:34:33.188 INFO 5088 --- [ Thread-15] 🐳 [docker-compose] : Removing volume cbx9ms68ba5j_healthcheck-volume
2020-08-31 22:34:33.213 INFO 5088 --- [ Test worker] 🐳 [docker-compose] : Docker Compose has finished running
com.users.UsersQueryResolverTest > classMethod FAILED
org.testcontainers.containers.ContainerLaunchException at GenericContainer.java:330
Caused by: org.rnorth.ducttape.RetryCountExceededException at Unreliables.java:88
Any ideas what might be the cause?
Thanks.
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 with DockerComposeContainer and the linked docker-compose.yml, then reproduce the failure by running the integration test classes repeatedly. Trace the transition from compose startup to GenericContainer's linking failure and inspect the logged container lifecycle. Done means identifying the cause and adding a regression test covering repeated compose startup and shutdown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, java, spring-boot
- Domain
- devops, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100