Browse Source

Merge pull request #25630 from abpframework/maliming/fix-identityserver-test-sqlite-flaky

Wrap IdentityServer test seed in single UoW to fix flaky SQLite lock
pull/25631/head
Engincan VESKE 4 months ago
committed by GitHub
parent
commit
7b27b4a673
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 27
      modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestBaseModule.cs

27
modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestBaseModule.cs

@ -1,8 +1,9 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.Threading; using Volo.Abp.Threading;
using Volo.Abp.Uow;
namespace Volo.Abp.IdentityServer; namespace Volo.Abp.IdentityServer;
[DependsOn( [DependsOn(
@ -38,9 +39,17 @@ public class AbpIdentityServerTestBaseModule : AbpModule
{ {
using (var scope = context.ServiceProvider.CreateScope()) using (var scope = context.ServiceProvider.CreateScope())
{ {
AsyncHelper.RunSync(() => scope.ServiceProvider AsyncHelper.RunSync(async () =>
.GetRequiredService<AbpIdentityServerTestDataBuilder>() {
.BuildAsync()); var unitOfWorkManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
using (var uow = unitOfWorkManager.Begin(requiresNew: true))
{
await scope.ServiceProvider
.GetRequiredService<AbpIdentityServerTestDataBuilder>()
.BuildAsync();
await uow.CompleteAsync();
}
});
} }
} }
} }

Loading…
Cancel
Save