testcontainers / testcontainers/testcontainers-java

DockerComposeContainer withExposedService default wait strategy fails

Open
#2,886 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

Hello again :)

Since I can't use container_name in my docker-compose.yml I have to dynamically set the configuration of a service via environment variables. To do so I call .getServiceHost() and .getServicePort() to retrieve the values. In order to be able to call them I need to add .withExposedService() to my DockerComposeContainer instance (that is already strange as I could just have ports or expose defined in my docker-compose.yml).

Using the default wait strategy fails because it tries to identify listening to some unknown port like 32824. As I see it's mapped either by ryuk or socat containers but the first one is not even at the same network all the services from the docker-compose.yml defined. As a workaround I just created a dummy anonymous class with an empty waitUntilReady implementation.

Why does it try to listen for the strange port not related to my service? Or why does the mapping between my service's port and the corresponding 'ambassador' one fail?

Thanks. Gonna appreciate any docs on that as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DockerComposeContainer and the withExposedService(), getServiceHost(), and getServicePort() entry points described in the report, then inspect the default wait strategy and its port mapping using the reported docker-compose.yml setup. Reproduce the failure and determine whether the strategy waits on the service's mapped port; done should mean the default strategy identifies the correct port or the required behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, java
Domain
devops, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.