разные правки по беку
This commit is contained in:
+6
-6
@@ -9,10 +9,10 @@ namespace Tnsu.ApprovalRoute.IntegrationTests.ApplicationServices;
|
||||
|
||||
/// <summary>
|
||||
/// Блокировка провижининга — единственное, что не даёт двум фоновым задачам создать
|
||||
/// по списку каждая, поэтому проверяется именно на живом Postgres: смысл здесь несёт
|
||||
/// атомарность условного UPDATE, а не код на C#.
|
||||
/// по партиции каждая, поэтому проверяется именно на живом Postgres: смысл здесь
|
||||
/// несёт атомарность условного UPDATE, а не код на C#.
|
||||
/// </summary>
|
||||
public sealed class RequestTypeProvisioningLockTests(PostgresDatabaseFixture fixture)
|
||||
public sealed class ListPartitioningLockTests(PostgresDatabaseFixture fixture)
|
||||
: IClassFixture<PostgresDatabaseFixture>
|
||||
{
|
||||
private static readonly TimeSpan StaleAfter = TimeSpan.FromMinutes(30);
|
||||
@@ -59,7 +59,7 @@ public sealed class RequestTypeProvisioningLockTests(PostgresDatabaseFixture fix
|
||||
// Action
|
||||
using (var scope = _provider.CreateScope())
|
||||
{
|
||||
await scope.ServiceProvider.GetRequiredService<RequestTypeProvisioningLock>()
|
||||
await scope.ServiceProvider.GetRequiredService<ListPartitioningLock>()
|
||||
.ReleaseAsync(requestTypeId, CancellationToken.None);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public sealed class RequestTypeProvisioningLockTests(PostgresDatabaseFixture fix
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<ApprovalRouteDbContext>();
|
||||
await db.Database.ExecuteSqlInterpolatedAsync(
|
||||
$"UPDATE request_types SET list_provisioning_started_at = now() - interval '1 hour' WHERE id = {requestTypeId}");
|
||||
$"UPDATE request_types SET list_partitioning_started_at = now() - interval '1 hour' WHERE id = {requestTypeId}");
|
||||
}
|
||||
|
||||
// Assert
|
||||
@@ -97,7 +97,7 @@ public sealed class RequestTypeProvisioningLockTests(PostgresDatabaseFixture fix
|
||||
private async Task<bool> TryAcquireAsync(int requestTypeId, TimeSpan? staleAfter = null)
|
||||
{
|
||||
using var scope = _provider.CreateScope();
|
||||
return await scope.ServiceProvider.GetRequiredService<RequestTypeProvisioningLock>()
|
||||
return await scope.ServiceProvider.GetRequiredService<ListPartitioningLock>()
|
||||
.TryAcquireAsync(requestTypeId, staleAfter ?? StaleAfter, CancellationToken.None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user