Skip to content

Commit 559cf95

Browse files
committed
fix: isolate DlqDatabase:DataDirectory per Simulator test factory instance
SimulatorWebApplicationFactory already isolated NamespaceRepository: DataDirectory with a per-instance GUID temp dir, but never applied the same override to DlqDatabase:DataDirectory. Every factory instance therefore shared one on-disk SQLite file. When xUnit ran test classes in parallel, concurrent instances raced on ApplySchemaUpgradesAsync's check-then-act column guard, and the second ALTER TABLE ADD COLUMN collided with "duplicate column name: CloudProvider" — SimulatedAzureMessagesTests.PeekMessages_AzureOrdersQueue_ReturnsActiveMessages and SimulatedAwsMessagesTests.PeekMessages_AwsCheckoutQueue_ReturnsActiveMessages. Reusing the same per-instance _testDataDir for DlqDatabase:DataDirectory gives each factory its own SQLite file, making the race structurally impossible rather than merely less likely. Verified: both previously failing tests pass in isolation, and the full suite (1524 unit + 73 integration) passes twice back-to-back under real parallel execution.
1 parent 9e1767a commit 559cf95

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

services/api/tests/ServiceHub.IntegrationTests/Infrastructure/SimulatorWebApplicationFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ protected override void ConfigureWebHost(IWebHostBuilder builder)
3131
["Security:Authentication:Enabled"] = "false",
3232
["Cors:AllowedOrigins:0"] = "*",
3333
["NamespaceRepository:DataDirectory"] = _testDataDir,
34+
["DlqDatabase:DataDirectory"] = _testDataDir,
3435
["RateLimit:MaxRequests"] = "9999",
3536
});
3637
});

0 commit comments

Comments
 (0)