feature: Trend Detection & Alert Suppression Windows
This commit is contained in:
@@ -32,12 +32,17 @@ public class ApiFixture : WebApplicationFactory<Program>, IAsyncLifetime
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
// Apply migrations against the test database on first run
|
||||
// Apply migrations before the host starts — background services such as
|
||||
// ThresholdCacheLoader query the database during StartAsync.
|
||||
var connectionString = "Host=localhost;Port=5436;Database=vigilcare_test;Username=postgres;Password=password";
|
||||
var options = new DbContextOptionsBuilder<AppDbContext>()
|
||||
.UseNpgsql(connectionString)
|
||||
.Options;
|
||||
await using (var migrateDb = new AppDbContext(options))
|
||||
await migrateDb.Database.MigrateAsync();
|
||||
|
||||
using var scope = Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
await db.Database.MigrateAsync();
|
||||
|
||||
// Flush the test Redis database (db=1) to avoid cross-test cache pollution
|
||||
var redis = scope.ServiceProvider.GetRequiredService<IConnectionMultiplexer>();
|
||||
var server = redis.GetServer(redis.GetEndPoints().First());
|
||||
await server.FlushDatabaseAsync(1);
|
||||
|
||||
Reference in New Issue
Block a user