troig
troig

Reputation: 7212

TestContainers GenericContainer start() never finishes

I'm using TestContainers for some acceptance-testing in a kotlin spring-boot project.

I start all the docker containers successfully except a particular one, for which the start() method never finishes although (apparently) the container has started successfully.

I see it running both:

I have simplified to the extreme the configuration, startup strategies, etc. but the problem still remains.

Any idea of what can be happening?

GenericContainer("docker-image-identifier:latest")
            .withImagePullPolicy(PullPolicy.defaultPolicy())
            .withStartupTimeout(Duration.ofSeconds(300))
            .withExposedPorts(38080, 8080)
            .withNetwork(network)
            .withEnv(
                mapOf(
                    "SPRING_PROFILES_ACTIVE" to "local,mock"
                    // and some more env
                )
            )

Upvotes: 0

Views: 1111

Answers (1)

troig
troig

Reputation: 7212

After further investigation, the issue was that, for some reasons, one of the exposed ports(38080) was not responding. In this case, TestContainers start() keeps trying to establish connection with the port until the configured timeout happens.

This is the reason why TestContainers was considering that the container hadn't been started successfully.

Upvotes: 0

Related Questions