@@ -192,7 +192,6 @@ public async Task DisableDiscovery_WhenPropertyIsTrue_SimpleWorking()
192192 connection . ConnectionString += ";DisableDiscovery=true" ;
193193 await connection . OpenAsync ( ) ;
194194 Assert . True ( ( bool ) ( await new YdbCommand ( connection ) { CommandText = "SELECT TRUE;" } . ExecuteScalarAsync ( ) ) ! ) ;
195- await YdbConnection . ClearPool ( connection ) ;
196195 }
197196
198197 [ Fact ]
@@ -307,16 +306,12 @@ private List<Task> GenerateTasks(string connectionString) => Enumerable.Range(0,
307306 Interlocked . Add ( ref _counter , scalar ) ;
308307 } ) . ToList ( ) ;
309308
310- protected override async Task OnDisposeAsync ( ) =>
311- await YdbConnection . ClearPool ( new YdbConnection ( _connectionStringTls ) ) ;
312-
313309 [ Fact ]
314310 public async Task BulkUpsertImporter_HappyPath_Add_Flush ( )
315311 {
316312 var tableName = $ "BulkImporter_{ Guid . NewGuid ( ) : N} ";
317313
318- var conn = new YdbConnection ( _connectionStringTls ) ;
319- await conn . OpenAsync ( ) ;
314+ await using var conn = await CreateOpenConnectionAsync ( ) ;
320315 try
321316 {
322317 await using ( var createCmd = conn . CreateCommand ( ) )
@@ -375,8 +370,7 @@ PRIMARY KEY (Id)
375370 public async Task BulkUpsertImporter_ThrowsOnInvalidRowCount ( )
376371 {
377372 var tableName = $ "BulkImporter_{ Guid . NewGuid ( ) : N} ";
378- var conn = new YdbConnection ( _connectionStringTls ) ;
379- await conn . OpenAsync ( ) ;
373+ await using var conn = await CreateOpenConnectionAsync ( ) ;
380374 try
381375 {
382376 await using ( var createCmd = conn . CreateCommand ( ) )
@@ -418,8 +412,7 @@ public async Task BulkUpsertImporter_MultipleImporters_Parallel()
418412 var table1 = $ "BulkImporter_{ Guid . NewGuid ( ) : N} _1";
419413 var table2 = $ "BulkImporter_{ Guid . NewGuid ( ) : N} _2";
420414
421- var conn = new YdbConnection ( _connectionStringTls ) ;
422- await conn . OpenAsync ( ) ;
415+ var conn = await CreateOpenConnectionAsync ( ) ;
423416 try
424417 {
425418 foreach ( var table in new [ ] { table1 , table2 } )
@@ -474,15 +467,16 @@ await Task.WhenAll(
474467 dropCmd . CommandText = $ "DROP TABLE { table } ";
475468 await dropCmd . ExecuteNonQueryAsync ( ) ;
476469 }
470+
471+ await conn . DisposeAsync ( ) ;
477472 }
478473 }
479474
480475 [ Fact ]
481476 public async Task BulkUpsertImporter_ThrowsOnNonexistentTable ( )
482477 {
483478 var tableName = $ "Nonexistent_{ Guid . NewGuid ( ) : N} ";
484- var conn = new YdbConnection ( _connectionStringTls ) ;
485- await conn . OpenAsync ( ) ;
479+ await using var conn = await CreateOpenConnectionAsync ( ) ;
486480
487481 var columns = new [ ] { "Id" , "Name" } ;
488482
0 commit comments