diff --git a/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule.cs b/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule.cs index 1b5ce037a1..eee78bbfd9 100644 --- a/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule.cs +++ b/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage; @@ -33,8 +32,10 @@ public class AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule : AbpM // Per-app keep-alive connections so the in-memory SQLite databases survive for the test's // lifetime (without an open connection, shared-cache in-memory databases are discarded). - // Disposed in OnApplicationShutdown so connections do not accumulate across tests. - private readonly List _keepAlive = new(); + // Uses AbpUnitTestSqliteConnection (SemaphoreSlim around CreateCommand) — SQLite isn't + // thread-safe and parallel xUnit collections would otherwise race. Disposed in + // OnApplicationShutdown so connections do not accumulate across tests. + private readonly List _keepAlive = new(); public override void PreConfigureServices(ServiceConfigurationContext context) { @@ -109,7 +110,7 @@ public class AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule : AbpM private void EnsureDatabase(string connectionString) { - var keepAlive = new SqliteConnection(connectionString); + var keepAlive = new AbpUnitTestSqliteConnection(connectionString); keepAlive.Open(); _keepAlive.Add(keepAlive);