Reusable containers and Gradle parallel test execution #4394
              
                Unanswered
              
          
                  
                    
                      keith-miller
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 2 replies
-
| @keith-miller it looks like, since your tests are executed in parallel, they all fail to find a running container and decide to start one. There isn't much that Testcontainers can do about it (we have no awareness of other Testcontainers sessions on the same machine, at least not yet), but you can workaround it by running a single job that would start these before your parallel test sessions, so that every parallel session will be able to discover running containers. | 
Beta Was this translation helpful? Give feedback.
                  
                    2 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
First off thank you for such a great library!
We have a question about reusing containers. We're currently switching our Gradle builds over to parallel mode, and we are noticing that we're having issues with our generic Redis container being started multiple times. Here is the init code block:
Then, we see during the run:

and after:

The CockroachDB/RabbitMQ seem to handle the startup race condition fine and only start one container. The Redis GenericContainer starts multiple times. So, is there a way to handle the startup race condition for the Redis container?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions