-
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-1417631 Disable pooling for jwt token authentication wit ke…
…y file (#948) ### Description SNOW-1417631 Disable pooling for jwt token authentication with key file ### Checklist - [x] Code compiles correctly - [x] Code is formatted according to [Coding Conventions](../blob/master/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
fe51400
commit ace8f90
Showing
7 changed files
with
118 additions
and
62 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
Snowflake.Data.Tests/UnitTests/ConnectionCacheManagerTest.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,46 @@ | ||
using NUnit.Framework; | ||
using Snowflake.Data.Client; | ||
using Snowflake.Data.Core.Session; | ||
using Snowflake.Data.Tests.Util; | ||
|
||
namespace Snowflake.Data.Tests.UnitTests | ||
{ | ||
[TestFixture, NonParallelizable] | ||
public class ConnectionCacheManagerTest | ||
{ | ||
private readonly ConnectionCacheManager _connectionCacheManager = new ConnectionCacheManager(); | ||
private const string ConnectionString = "db=D1;warehouse=W1;account=A1;user=U1;password=P1;role=R1;minPoolSize=1;"; | ||
private static PoolConfig s_poolConfig; | ||
|
||
[OneTimeSetUp] | ||
public static void BeforeAllTests() | ||
{ | ||
s_poolConfig = new PoolConfig(); | ||
SnowflakeDbConnectionPool.SetConnectionPoolVersion(ConnectionPoolType.SingleConnectionCache); | ||
SessionPool.SessionFactory = new MockSessionFactory(); | ||
} | ||
|
||
[OneTimeTearDown] | ||
public static void AfterAllTests() | ||
{ | ||
s_poolConfig.Reset(); | ||
SessionPool.SessionFactory = new SessionFactory(); | ||
} | ||
|
||
[SetUp] | ||
public void BeforeEach() | ||
{ | ||
_connectionCacheManager.ClearAllPools(); | ||
} | ||
|
||
[Test] | ||
public void TestEnablePoolingRegardlessOfConnectionStringProperty() | ||
{ | ||
// act | ||
var pool = _connectionCacheManager.GetPool(ConnectionString + "poolingEnabled=false"); | ||
|
||
// assert | ||
Assert.IsTrue(pool.GetPooling()); | ||
} | ||
} | ||
} |
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
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