Skip to content

Properly stop / clean / dispose #410

Answered by HofmeisterAn
lonix1 asked this question in Q&A
Discussion options

You must be logged in to vote
  • StopAsync will just stop the container. All ressources remain. You can start the container in the same .NET Testcontainers run again.
  • CleanUpAsync will remove the container resource. Be aware of #242. We did some further improvements, but there are edge cases where we are not able to remove the container resource yet. Anyway, if you setup a proper test, most cases will work.
  • DisposeAsync chooses between these too implementations, it depends on whether you set WithCleanUp or not. By default, it is set to true.

It is not necessary to call StopAsync or CleanUpAsync if you are using the await using pattern. DisposeAsync helps to reduce the cleanup code. Usually, you set WithCleanUp to false

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@lonix1
Comment options

Answer selected by lonix1
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants