Skip to content

Commit

Permalink
test with unique connection string per test
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-knozderko committed Dec 20, 2023
1 parent 69d2545 commit 939f9f7
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ public void TestReuseSessionInConnectionPoolReachingMaxConnections() // old name
public void TestWaitForTheIdleConnectionWhenExceedingMaxConnectionsLimit()
{
// arrange
var pool = SnowflakeDbConnectionPool.GetPool(ConnectionString);
var connectionString = ConnectionString + "application=TestWaitForTheIdleConnectionWhenExceedingMaxConnectionsLimit";
var pool = SnowflakeDbConnectionPool.GetPool(connectionString);
Assert.AreEqual(0, pool.GetCurrentPoolSize(), "expecting pool to be empty");
pool.SetMaxPoolSize(2);
pool.SetWaitingTimeout(1000);
var conn1 = OpenedConnection();
var conn2 = OpenedConnection();
var conn1 = OpenedConnection(connectionString);
var conn2 = OpenedConnection(connectionString);
var watch = new Stopwatch();

// act
Expand All @@ -130,11 +131,12 @@ public void TestWaitForTheIdleConnectionWhenExceedingMaxConnectionsLimit()
public void TestWaitInAQueueForAnIdleSession()
{
// arrange
var pool = SnowflakeDbConnectionPool.GetPool(ConnectionString);
var connectionString = ConnectionString + "application=TestWaitInAQueueForAnIdleSession";
var pool = SnowflakeDbConnectionPool.GetPool(connectionString);
Assert.AreEqual(0, pool.GetCurrentPoolSize(), "the pool is expected to be empty");
pool.SetMaxPoolSize(2);
pool.SetWaitingTimeout(3000);
var threads = new ConnectingThreads(ConnectionString)
var threads = new ConnectingThreads(connectionString)
.NewThread("A", 0, 2000, true)
.NewThread("B", 50, 2000, true)
.NewThread("C", 100, 0, true)
Expand Down Expand Up @@ -257,10 +259,10 @@ public void TestNewConnectionPoolClean()
Assert.AreEqual(ConnectionState.Closed, conn3.State);
}

private SnowflakeDbConnection OpenedConnection()
private SnowflakeDbConnection OpenedConnection(string connectionString)
{
var connection = new SnowflakeDbConnection();
connection.ConnectionString = ConnectionString;
connection.ConnectionString = connectionString;
connection.Open();
return connection;
}
Expand Down

0 comments on commit 939f9f7

Please sign in to comment.