Skip to content

Commit 6ea1491

Browse files
committed
Defer new pool class to next PR. Add test to boost code coverage.
1 parent b799f10 commit 6ea1491

File tree

5 files changed

+29
-126
lines changed

5 files changed

+29
-126
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@
9595
<Compile Include="$(CommonSourceRoot)\Microsoft\Data\ProviderBase\DbConnectionFactory.cs">
9696
<Link>Microsoft\Data\ProviderBase\DbConnectionFactory.cs</Link>
9797
</Compile>
98-
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs">
99-
<Link>Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs</Link>
100-
</Compile>
10198
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\DbConnectionPoolAuthenticationContext.cs">
10299
<Link>Microsoft\Data\SqlClient\ConnectionPool\DbConnectionPoolAuthenticationContext.cs</Link>
103100
</Compile>

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,6 @@
279279
<Compile Include="$(CommonSourceRoot)Microsoft\Data\ProviderBase\DbConnectionInternal.cs">
280280
<Link>Microsoft\Data\ProviderBase\DbConnectionInternal.cs</Link>
281281
</Compile>
282-
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs">
283-
<Link>Microsoft\Data\SqlClient\ConnectionPool\ChannelDbConnectionPool.cs</Link>
284-
</Compile>
285282
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ConnectionPool\DbConnectionPoolAuthenticationContext.cs">
286283
<Link>Microsoft\Data\SqlClient\ConnectionPool\DbConnectionPoolAuthenticationContext.cs</Link>
287284
</Compile>

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/ChannelDbConnectionPool.cs

Lines changed: 0 additions & 118 deletions
This file was deleted.

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/DbConnectionPoolGroup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using Microsoft.Data.Common;
77
using Microsoft.Data.ProviderBase;
8+
using System;
89
using System.Collections.Concurrent;
910
using System.Collections.Generic;
1011
using System.Diagnostics;
@@ -189,8 +190,7 @@ internal IDbConnectionPool GetConnectionPool(DbConnectionFactory connectionFacto
189190
IDbConnectionPool newPool;
190191
if (LocalAppContextSwitches.UseConnectionPoolV2)
191192
{
192-
// ChannelDbConnectionPool is the v2 pool implementation
193-
newPool = new ChannelDbConnectionPool();
193+
throw new NotImplementedException();
194194
}
195195
else
196196
{

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectionPoolTest/ConnectionPoolTest.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,31 @@ public static void BasicConnectionPoolingTest(string connectionString)
7373
}
7474
}
7575

76+
/// <summary>
77+
/// Tests that when UseConnectionPoolV2 context switch is enabled, opening a connection throws NotImplementedException
78+
/// </summary>
79+
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
80+
[ClassData(typeof(ConnectionPoolConnectionStringProvider))]
81+
public static void UseConnectionPoolV2ThrowsNotImplemented(string connectionString)
82+
{
83+
try
84+
{
85+
// Enable the UseConnectionPoolV2 context switch
86+
AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.UseConnectionPoolV2", true);
87+
88+
using (SqlConnection connection = new SqlConnection(connectionString))
89+
{
90+
// This should throw NotImplementedException
91+
Assert.Throws<NotImplementedException>(() => connection.Open());
92+
}
93+
}
94+
finally
95+
{
96+
// Reset the context switch
97+
AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.UseConnectionPoolV2", false);
98+
}
99+
}
100+
76101
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.IsAADPasswordConnStrSetup), nameof(DataTestUtility.IsAADAuthorityURLSetup))]
77102
public static void AccessTokenConnectionPoolingTest()
78103
{
@@ -199,6 +224,8 @@ public static void MaxPoolWaitForConnectionTest(string connectionString)
199224
Assert.Equal(TaskStatus.RanToCompletion, waitTask.Status);
200225
}
201226

227+
228+
202229
internal static InternalConnectionWrapper ReplacementConnectionUsesSemaphoreTask(string connectionString, Barrier syncBarrier)
203230
{
204231
InternalConnectionWrapper internalConnection = null;

0 commit comments

Comments
 (0)