Skip to content

Commit 1c302b0

Browse files
fix test
1 parent 48612f0 commit 1c302b0

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/Ydb.Sdk/test/Ydb.Sdk.Ado.Tests/TestBase.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@ protected static YdbConnection CreateOpenConnection()
2020

2121
protected static async Task<YdbConnection> CreateOpenConnectionAsync()
2222
{
23-
var connection = CreateConnection();
24-
await connection.OpenAsync();
25-
return connection;
23+
try
24+
{
25+
var connection = CreateConnection();
26+
await connection.OpenAsync();
27+
return connection;
28+
}
29+
catch (YdbException e) when (e is { Code: StatusCode.Unspecified, Message: "Session Source is disposed." })
30+
{
31+
var connection = CreateConnection();
32+
await connection.OpenAsync();
33+
return connection;
34+
}
2635
}
2736

2837
public async Task InitializeAsync() => await OnInitializeAsync().ConfigureAwait(false);

src/Ydb.Sdk/test/Ydb.Sdk.Ado.Tests/YdbConnectionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public async Task DisableDiscovery_WhenPropertyIsTrue_SimpleWorking()
211211
public async Task OpenAsync_WhenCancelTokenIsCanceled_ThrowYdbException()
212212
{
213213
await using var connection = CreateConnection();
214-
connection.ConnectionString = ConnectionString;
214+
connection.ConnectionString = ConnectionString + ";MinSessionPool=1";
215215
using var cts = new CancellationTokenSource();
216216
cts.Cancel();
217217
Assert.Equal("The connection pool has been exhausted, either raise 'MaxSessionPool' (currently 10) " +

0 commit comments

Comments
 (0)