testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
7.96k stars 1.64k forks source link

`FAIL_FAST_ALWAYS` for selection of `DockerClientProviderStrategy` not reset in flaky environments when tests are retried #5017

Open arhont375 opened 2 years ago

arhont375 commented 2 years ago

Hello team! Please provide ability to disable FAIL_FAST_ALWAYS usage for the selection of DockerClientProviderStrategy located here: https://github.com/testcontainers/testcontainers-java/blob/abf18468c2b3c8ec395f07fe91cd3afd449e28d2/core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java#L55

Our use case:

Having ability to disable this flag on demand or being able to forcibly configure retries even if that flag is set would be helpful in our situation

kiview commented 2 years ago

Hi @arhont375, thanks for reporting this issue and sharing the details of your Testcontainers setup. I am not yet sure if we should follow up on your suggested implementation, or need to look at the root cause first to make the code generally more robust, but I can understand that a case of resource contention together with the Test Retry Gradle plugin can lead to this failure scenario.

arhont375 commented 2 years ago

Thank you for quick response! Please let me know if there is something that I can help with

kiview commented 2 years ago

Thanks for the offer @arhont375. Do you have a way to reliably reproduce your issues? In this case, I might come back to you for trying out a PR to mitigate this situation, once we come around to tackling this.

kiview commented 2 years ago

One question I forgot to ask you @arhont375, can you describe your setup? Is this happening locally or on CI? How is Docker installed?

arhont375 commented 2 years ago

One question I forgot to ask you @arhont375, can you describe your setup? Is this happening locally or on CI? How is Docker installed?

This reproducible locally (ubuntu, system installation of docker) and in the CI (Jenkins + CentoOS + system installation of docker).

This may depend on machine that execute it, but following repo allow to reproduce it on my small machine (2 cores, 4 threads, Intel Core i7): https://github.com/arhont375/test-containters-5017 Even if it will not fail for you it may give picture about how tests executed in our environment: parallel execution of projects in gradle + parallel execution of tests via JUnit + many short living tests using containers. PS I added gradle-test-retry plugin there, but somehow not sure if it set up properly.

kiview commented 2 years ago

Thanks, this information helps a lot, because this shows it happens on a native Linux Docker installation, rather than Docker Desktop (on Mac or Windows), which would further complicate debugging.

So we might see an overloaded single Docker daemon in your case (which might lead to errors when being pinged).

hadson172 commented 12 months ago

Having same issue. Any help on this?

arhont375 commented 12 months ago

Having same issue. Any help on this?

Don't work there anymore, but I think we forcibly redefined flag via reflection.