feat(processing): persist safe atomic operation history
This commit is contained in:
@@ -362,9 +362,15 @@ public sealed class CvProcessingOperationTests
|
||||
|
||||
public static async Task<Fixture> CreateAsync()
|
||||
{
|
||||
var connection = new SqliteConnection("Data Source=:memory:");
|
||||
await connection.OpenAsync();
|
||||
var tempRoot = Path.Combine(Path.GetTempPath(), $"jobtracker-cv-operation-{Guid.NewGuid():N}");
|
||||
Directory.CreateDirectory(tempRoot);
|
||||
var connection = new SqliteConnection($"Data Source={Path.Combine(tempRoot, "operations.db")};Pooling=False;Default Timeout=5");
|
||||
await connection.OpenAsync();
|
||||
await using (var command = connection.CreateCommand())
|
||||
{
|
||||
command.CommandText = "PRAGMA journal_mode=WAL;";
|
||||
await command.ExecuteNonQueryAsync();
|
||||
}
|
||||
var configuration = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary<string, string?>
|
||||
{
|
||||
["Data:Root"] = tempRoot,
|
||||
@@ -407,7 +413,8 @@ public sealed class CvProcessingOperationTests
|
||||
services.AddHttpContextAccessor();
|
||||
services.AddScoped<CurrentUserService>();
|
||||
services.AddScoped<ICurrentUserService>(provider => provider.GetRequiredService<CurrentUserService>());
|
||||
services.AddDbContext<JobTrackerContext>((_, options) => options.UseSqlite(connection));
|
||||
// Separate connections observe committed state, unlike a shared in-memory connection.
|
||||
services.AddDbContext<JobTrackerContext>((_, options) => options.UseSqlite(connection.ConnectionString));
|
||||
services.AddIdentityCore<ApplicationUser>().AddRoles<IdentityRole>().AddEntityFrameworkStores<JobTrackerContext>();
|
||||
services.AddSingleton(TimeProvider.System);
|
||||
services.AddSingleton(new AppPaths(configuration, environment.Object));
|
||||
|
||||
Reference in New Issue
Block a user