Server: start a retried write transaction from the database, not from the attempt that failed

This commit is contained in:
jaap-jan committed 2026-10-02 14:15:52 +02:00
1 parent 36fb0817a4
commit b2516ca7fb
8 files changed
+173 -21

No files matched your search

+9 -1
View File
@@ -14,6 +14,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.PostgreSql;
using Xunit;
using Microsoft.EntityFrameworkCore.Diagnostics;
namespace DodoSSH.Api.Tests;
@@ -108,9 +109,16 @@ public sealed class ApiFixture : WebApplicationFactory<Program>, IAsyncLifetime
Environment.SetEnvironmentVariable(name, value);
}
builder.ConfigureTestServices(services => services.AddSingleton<IRelayNetwork>(RelayNetwork));
builder.ConfigureTestServices(services =>
{
services.AddSingleton<IRelayNetwork>(RelayNetwork);
services.AddSingleton<IInterceptor>(Commits);
});
}
/// <summary>Fails a commit on request, so a test can watch the retrying execution strategy at work.</summary>
internal FlakyCommits Commits { get; } = new();
/// <summary>
/// What the relay resolves and dials, in place of the machine's own resolver and sockets.
/// </summary>