Skip to content

Unsure if there is a bug when using ".WithPortBinding()" or if I'm not using TestContainers correctly #1345

Discussion options

You must be logged in to vote

According to the NUnit documentation also:

I see, then test fixtures behave differently than the collections in xUnit.net. I haven't used NUnit in a long time (and just assumed that).

I checked out your reproducer and took a look at it. It seems that the PostgreSQL client library caches the connection (using a connection pool). I'm not sure if there are other ways to disable pooling, but you can clear the pool using:

NpgsqlConnection.ClearAllPools();

I noticed another issue in your reproducer. Remove the [TestFixture] attribute from the base class. Here's my updated diff that works:

diff --git a/TestContainer_Port_Bug_Demo/BaseTest.cs b/TestContainer_Port_Bug_Demo/BaseTest.cs
index b…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@stefanteodoropol
Comment options

@HofmeisterAn
Comment options

@stefanteodoropol
Comment options

@HofmeisterAn
Comment options

Answer selected by HofmeisterAn
@stefanteodoropol
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants