-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pool/snow-902610 min pool size (#880)
### Description Min pool size ### Checklist - [x] Code compiles correctly - [x] Code is formatted according to [Coding Conventions](../CodingConventions.md) - [x] Created tests which fail without the change (if possible) - [x] All tests passing (`dotnet test`) - [x] Extended the README / documentation, if necessary - [x] Provide JIRA issue id (if possible) or GitHub issue id in PR name
- Loading branch information
1 parent
052d895
commit 0983d94
Showing
17 changed files
with
431 additions
and
97 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
Snowflake.Data.Tests/IntegrationTests/ConnectionMultiplePoolsAsyncIT.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
using Snowflake.Data.Client; | ||
using Snowflake.Data.Core.Session; | ||
using Snowflake.Data.Tests.Util; | ||
|
||
namespace Snowflake.Data.Tests.IntegrationTests | ||
{ | ||
[TestFixture] | ||
[NonParallelizable] | ||
public class ConnectionMultiplePoolsAsyncIT: SFBaseTestAsync | ||
{ | ||
private readonly PoolConfig _previousPoolConfig = new PoolConfig(); | ||
|
||
[SetUp] | ||
public new void BeforeTest() | ||
{ | ||
SnowflakeDbConnectionPool.SetConnectionPoolVersion(ConnectionPoolType.MultipleConnectionPool); | ||
SnowflakeDbConnectionPool.ClearAllPools(); | ||
} | ||
|
||
[TearDown] | ||
public new void AfterTest() | ||
{ | ||
_previousPoolConfig.Reset(); | ||
} | ||
|
||
[Test] | ||
public async Task TestMinPoolSizeAsync() | ||
{ | ||
// arrange | ||
var connection = new SnowflakeDbConnection(); | ||
connection.ConnectionString = ConnectionString + "application=TestMinPoolSizeAsync;minPoolSize=3"; | ||
|
||
// act | ||
await connection.OpenAsync().ConfigureAwait(false); | ||
Thread.Sleep(3000); | ||
|
||
// assert | ||
var pool = SnowflakeDbConnectionPool.GetPool(connection.ConnectionString); | ||
Assert.AreEqual(3, pool.GetCurrentPoolSize()); | ||
|
||
// cleanup | ||
await connection.CloseAsync(CancellationToken.None).ConfigureAwait(false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Snowflake.Data.Tests/IntegrationTests/ConnectionSinglePoolCacheIT.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.