This commit is contained in:
Janus C. H. Knudsen 2026-01-10 20:39:17 +01:00
parent 54b057886c
commit 7fc1ae0650
204 changed files with 4345 additions and 134 deletions

View file

@ -11,6 +11,7 @@ using PlanTempus.Core.Email;
using PlanTempus.Core.ModuleRegistry;
using PlanTempus.Core.Outbox;
using PlanTempus.Core.SeqLogging;
using PlanTempus.Core.Telemetry;
using PlanTempus.Database.ModuleRegistry;
using CrypticWizard.RandomWordGenerator;
@ -84,6 +85,7 @@ public abstract class BddTestFixture : FeatureFixture
PostmarkConfiguration = configuration.GetSection("Postmark").ToObject<PostmarkConfiguration>()
});
builder.RegisterType<NotificationChannel>().As<IMessageChannel<string>>().SingleInstance();
builder.RegisterType<OutboxListener>().SingleInstance();
builder.RegisterType<SeqBackgroundService>().SingleInstance();
@ -104,8 +106,11 @@ public abstract class BddTestFixture : FeatureFixture
[TestCleanup]
public void CleanupContainer()
{
// 1. Stop OutboxListener først (så der ikke genereres mere telemetry)
_cts?.Cancel();
_outboxListener?.StopAsync(CancellationToken.None).Wait();
// 2. Stop SeqBackgroundService - den sender stop signal, dræner channel og lukker ned
_seqBackgroundService?.StopAsync(CancellationToken.None).Wait();
Trace.Flush();
@ -121,7 +126,7 @@ public abstract class BddTestFixture : FeatureFixture
}
catch (System.Threading.Channels.ChannelClosedException)
{
// Channel already closed by SeqBackgroundService.StopAsync
// Channel already closed
}
Container = null;