You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am fiddling around with a small testcontainers example app using .net core 5.0.101 and latest rider IDE on OSX 10.15.7
(no M1).
I tried to use the WithName method on my postgrescontainer. The tests are successfully running, but failing the second time I run them.
It seems the WithCleanup-Method does not get called correctly (anymore?)
To Reproduce
Steps to reproduce the behavior:
Create new project
add testcontainer with 'WithName' and 'WithCleanup(true)'
Run tests more than once
Error coming up: OneTimeSetUp: Docker.DotNet.DockerApiException : Docker API responded with status code=Conflict, response={"message":"Conflict. The container name \"/test\" is already in use by container \"6414b598be12718f4061736e8feccefac26ff0402c45ff4c41152bd1d0ec481c\". You have to remove (or rename) that container to be able to reuse that name."}
the commands docker container ls -a and docker volume ls are showing the not cleaned-up container afterards and they have to be pruned manually.
I added a video to show the behaviour.
Expected behavior
Docker Container created by TestContainers gets cleaned up correctly
Desktop (please complete the following information):
Testcontainers v 1.5.0-beta.20201201.11
OSX 10.15.7
Rider 2020.2
.Net Core SDK 5.0.101
Docker for Mac w/ engine v20.10.0
Additional context
I am using NUnits OneTimeSetup and OneTimeTearDown together with testcontainers StartAsync / StopAsync - could that be a problem? (see code in video) edit: No, doesnt have something to do with the onetime-attributes. tried it in another namespace with normal setup/teardown, same behaviour. 2 unit tests, 2 new containers/volumes that do not get cleaned afterwards.
Feel free to reach out for help. I'd be happy to debug this myself (or pairing with you) and see if I could fix it, but tbh I have no clue on how to add the testcontainers code to my project the right way to get it to work(tried once, failed).
The text was updated successfully, but these errors were encountered:
As far as I can see, you do not call Dispose in your code. You have to dispose either with the using block or call it manual. Otherwise, the container won't be removed. Also notice following behavior #242. To avoid #242 we could persist the containers in TestcontainersRegistryService and remove them at the first start or use something like the ResourceReaper.
argh... i hate myself and... well. with dispose everything works as intended. nvm :D I saw the other issue, but mine was slightly different (due to classical layer 8 as it turns out). Thanks for the quick response! :)
Describe the bug
I am fiddling around with a small testcontainers example app using .net core 5.0.101 and latest rider IDE on OSX 10.15.7
(no M1).
I tried to use the
WithName
method on my postgrescontainer. The tests are successfully running, but failing the second time I run them.It seems the WithCleanup-Method does not get called correctly (anymore?)
To Reproduce
Steps to reproduce the behavior:
OneTimeSetUp: Docker.DotNet.DockerApiException : Docker API responded with status code=Conflict, response={"message":"Conflict. The container name \"/test\" is already in use by container \"6414b598be12718f4061736e8feccefac26ff0402c45ff4c41152bd1d0ec481c\". You have to remove (or rename) that container to be able to reuse that name."}
the commands
docker container ls -a
anddocker volume ls
are showing the not cleaned-up container afterards and they have to be pruned manually.I added a video to show the behaviour.
Expected behavior
Docker Container created by TestContainers gets cleaned up correctly
Screenshots
see video here (10mb limit at github, so uploaded to yt instead for HD): https://www.youtube.com/watch?v=YdJ59LX5Kjc
Desktop (please complete the following information):
Additional context
I am using NUnits
OneTimeSetup
andOneTimeTearDown
together with testcontainersStartAsync
/StopAsync
- could that be a problem? (see code in video) edit: No, doesnt have something to do with the onetime-attributes. tried it in another namespace with normal setup/teardown, same behaviour. 2 unit tests, 2 new containers/volumes that do not get cleaned afterwards.Feel free to reach out for help. I'd be happy to debug this myself (or pairing with you) and see if I could fix it, but tbh I have no clue on how to add the testcontainers code to my project the right way to get it to work(tried once, failed).
The text was updated successfully, but these errors were encountered: