Skip to content

Commit

Permalink
SNOW-937188 added test to cover pool retrieval not working for invali…
Browse files Browse the repository at this point in the history
…d connection string
  • Loading branch information
sfc-gh-mhofman committed May 9, 2024
1 parent b8e3634 commit bcce8ef
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.Net;
using System.Text.RegularExpressions;
using NUnit.Framework;
using Snowflake.Data.Client;
using Snowflake.Data.Core;
using Snowflake.Data.Core.Session;
using Snowflake.Data.Tests.Util;

namespace Snowflake.Data.Tests.UnitTests.Session
{
Expand Down Expand Up @@ -86,6 +89,20 @@ public void TestPoolIdentificationBasedOnConnectionString(string connectionStrin
Assert.AreEqual(expectedPoolIdentification, poolIdentification);
}

[Test]
public void TestRetrievePoolFailureForInvalidConnectionString()
{
// arrange
var invalidConnectionString = "account=someAccount;db=someDb;host=someHost;user=SomeUser;port=443"; // invalid because password is not provided

// act
var exception = Assert.Throws<SnowflakeDbException>(() => SessionPool.CreateSessionPool(invalidConnectionString, null));

// assert
SnowflakeDbExceptionAssert.HasErrorCode(exception, SFError.MISSING_CONNECTION_PROPERTY);
Assert.IsTrue(exception.Message.Contains("Required property PASSWORD is not provided"));
}

[Test]
public void TestPoolIdentificationBasedOnInternalId()
{
Expand Down

0 comments on commit bcce8ef

Please sign in to comment.