-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: listChildContainers should be case insensitive - causes waitUntilServiceStarted to fail #6943
Comments
You are using compose v2 and it is not currently supported. See #5278 |
That explains why running |
There are differences between compose v1 and v2. The one is impacting Testcontainers is
See more here
There is an option in docker desktop which IIRC creates a symlink so executing |
Thank you for your reply, @eddumelendez. Since I'm running using Does |
No, it doesn't. What happens in that case is a docker image is downloaded and the docker-compose.yml file is copied and executed in that container |
@eddumelendez , that is what I expected and matchs what I've seen. Since this bug is seen running using |
I see, you are running ARM. And the existing docker image doesn't work on ARM. See #5524. So, we already have issues for those cases. |
Once #5608 is merged, both issues should be solved |
@eddumelendez, this does not seem to be an ARM related problem, sincemy work around listed in the original ticket makes TestContainer work. I think this is an entirely separate issue (and much smaller issue). |
I've reopen it and take a look closer later |
According to the [docs]https://docs.docker.com/compose/environment-variables/envvars/#compose_project_name(), `COMPOSE_PROJECT_NAME` must be lowescase. Fixes #6943
Sorry for the confusion @mccants-heb. I've submitted a PR adding a test case and fix for this issue. Thanks for the report. |
According to the [docs](https://docs.docker.com/compose/environment-variables/envvars/#compose_project_name), `COMPOSE_PROJECT_NAME` must be lowescase. Fixes #6943
Module
Core
Testcontainers version
1.18.0
Using the latest Testcontainers version?
Yes
Host OS
Mac OS
Host Arch
ARM
Docker version
What happened?
Running with DockerComposeContainer, I cannot properly wait for Services.
Example code that is failing:
Here is the error message:
This is caused because DockerComposeContainer.waitUntilServiceStarted() calls listChildContainers and it returns no child containers, even though it should. The reason it doesn't is because it fails to properly compare names on this line:
.filter(container -> Arrays.stream(container.getNames()).anyMatch(name -> name.startsWith("/" + project)))
In my case, the project name is
OrderGroupProcessApiFunctionalTest_b8kvyt
, but the name of the matching container is/ordergroupprocessapifunctionaltest_b8kvyt_flyway_1
. The filter states filters out this container, because the filter statement is case sensitive.This results in DockerComposeContainer.waitUntilServiceStarted() putting something in missingServiceInstances and throw an IllegalStateException resulting in the error message above.
Worse, this leaves orphaned Docker instances after the test completes.
Relevant log output
No response
Additional Information
Work around: lower case the project name when creating DockerComposeContainer.
The text was updated successfully, but these errors were encountered: