-
Notifications
You must be signed in to change notification settings - Fork 257
Closed
Copy link
Milestone
Description
We have a set of tests that use different contexts with following setup:
- all tests run sequentially (no parallel execution)
- there are several database contexts used by tests
- if context is not initialized yet during current test run, it will ensure test database is ready using
context.Database.EnsureDeleted();
context.Database.EnsureCreated();This works fine for different db providers (we test sqlite, sqlserver, mysql and npgsql) and versions (3.1, 6, 8). But in v9 now it fails to create database for Npgsql on second call to snippet above. Basically only 1 context being initialized per test run, second initialization fails with:
System.InvalidOperationException
HResult=0x80131509
Message=An exception has been raised that is likely due to a transient failure.
Source=Npgsql.EntityFrameworkCore.PostgreSQL
StackTrace:
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) in Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal\NpgsqlExecutionStrategy.cs:line 28
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IReadOnlyList`1 migrationCommands, IRelationalConnection connection, MigrationExecutionState executionState, Boolean commitTransaction, Nullable`1 isolationLevel)
at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable`1 migrationCommands, IRelationalConnection connection)
at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlDatabaseCreator.CreateTables() in Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal\NpgsqlDatabaseCreator.cs:line 210
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()
at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreated()
at LinqToDB.EntityFrameworkCore.Tests.ContextTestBase`1.InitializeDatabase(TContext context, String provider, String connectionString) in C:\GitHub\linq2db\Tests\EntityFrameworkCore\ContextTestBase.cs:line 119
at LinqToDB.EntityFrameworkCore.Tests.ContextTestBase`1.CreateContext(String provider, Func`2 optionsSetter, Func`2 optionsBuilderSetter) in C:\GitHub\linq2db\Tests\EntityFrameworkCore\ContextTestBase.cs:line 159
at LinqToDB.EntityFrameworkCore.Tests.InterceptorTests.TestEfCoreSideOfComboInterceptor(String provider) in C:\GitHub\linq2db\Tests\EntityFrameworkCore\Tests\InterceptorTests.cs:line 109
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
This exception was originally thrown at this call stack:
System.Net.Sockets.NetworkStream.Read(byte[], int, int)
Inner Exception 1:
NpgsqlException: Exception while reading from stream
Inner Exception 2:
IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine..
Inner Exception 3:
SocketException: An established connection was aborted by the software in your host machine.
Currently looking into providing isolated repro code
Reactions are currently unavailable