Browse Source

Address Copilot review feedback

pull/25319/head
maliming 5 months ago
parent
commit
d85d7101ed
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 9
      modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo/Abp/Identity/EntityFrameworkCore/AbpIdentitySharedUserSeparateDbEntityFrameworkCoreTestModule.cs

9
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<SqliteConnection> _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<AbpUnitTestSqliteConnection> _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);

Loading…
Cancel
Save