1

I'm running my dotnet 7.0 tests using "testcontainers" on windows machine. The tests are parallelized integration tests which use SQL Server inside a Linux docker container. Each test creates its own database.

When I run less than 16 tests at the same time, they all pass. But when I run more than that (and my IDE limits it to 16) it gets stuck and nothing will happen. If I wait for a day it's still trying to run the first 16 tests.

Same thing happens on VS and Rider.

There is nothing interesting in docker logs and I don't know where else to look.

When I open the task manager I can see that docker keeps restarting some its services, as it's constantly alternating between these two states:

enter image description here enter image description here

Update:

I found a solution by limiting the parallel tests in my infrastructure by running batches of 10. But I'm still wondering why this happens in the first place. Is it testcontainers bug or docker's? Anyone else has a similar experience?

2 Answers 2

0

It might be a memory issue, I found using Docker in Windows with WSL ate RAM to the point of crashing and I had to restart the Docker daemon, I want only creating 6 containers, and I have 16GB of RAM!

If your using Docker Compose you can just run docker compose up and it will launch all the containers and you will get the output of each program that starts running in each container. You can then output it to a logfile for further analysis.

Or if your just using Dockerfile for this I would assume it's either RAM or a DB concurrency issue or maybe if you log into the DB with the same user it has a connection limit set. If you could share your docker-compose.yaml or Dockerfile that could help us fix the issue.

2
  • Thanks for the reply. I'm not using dockerfile nor docker-compose. I'm using testcontainers which automatically creates and starts containers when running xunit tests.
    – Bizhan
    Commented Feb 22 at 15:25
  • Unfortunatly I've never used TestContainers but you could try and run the tests in a parallel way in a single docker container. If your containers are using the Bash Shell you can write test1cmd& test2cmd& test3cmd& wait this will run test1,2,3cmd all at the same time. if you remove the ampersand they will run in a synchronous way and with the & it's asynchronous
    – Definity
    Commented Feb 22 at 20:12
0

I had a similar issue where I would run my integration tests that relied on a some docker containers but they would just hang and then fail. Turns out there is an setting called "Enable Resource Saver" that I disabled and now my tests run fine every time. This setting can be found in Settings -> Resources -> Advanced

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.