Skip to content

Commit 028d572

Browse files
rojiCopilot
andcommitted
Fix test store connection cleanup
Close NpgsqlTestStore helper-opened connections after sync and async command execution to avoid accumulating idle test connections. Disable SSL in the CI test connection string to avoid Windows SSL handshake pressure during functional tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9b3177a commit 028d572

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
run: dotnet test -c ${{ matrix.config }} --logger "GitHubActions;report-warnings=false"
116116
shell: bash
117117
env:
118-
Test__Npgsql__DefaultConnection: Server=localhost;Username=npgsql_tests;Password=npgsql_tests
118+
Test__Npgsql__DefaultConnection: Server=localhost;Username=npgsql_tests;Password=npgsql_tests;SSL Mode=Disable
119119

120120
- id: analyze_tag
121121
name: Analyze tag

test/EFCore.PG.FunctionalTests/TestUtilities/NpgsqlTestStore.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ private static T ExecuteCommand<T>(
341341
}
342342
finally
343343
{
344-
if (connection.State == ConnectionState.Closed
345-
&& connection.State != ConnectionState.Closed)
344+
if (connection.State != ConnectionState.Closed)
346345
{
347346
connection.Close();
348347
}
@@ -389,8 +388,7 @@ private static async Task<T> ExecuteCommandAsync<T>(
389388
}
390389
finally
391390
{
392-
if (connection.State == ConnectionState.Closed
393-
&& connection.State != ConnectionState.Closed)
391+
if (connection.State != ConnectionState.Closed)
394392
{
395393
await connection.CloseAsync();
396394
}

0 commit comments

Comments
 (0)