From d83b433aafcb9cfa63b916684d16061e0cb810cc Mon Sep 17 00:00:00 2001 From: Mauro Servienti Date: Wed, 6 May 2026 16:07:45 +0200 Subject: [PATCH] Fix Windows-RabbitMQ RunScenario test timeout and cascade failures GetThroughputPerDay loops 96 times (24*4), each requiring an HTTP call to the RabbitMQ management API plus sending and receiving 15 messages. On Windows CI, this consistently exceeds the 60-second TestTimeout that bounds all CreateTaskCompletionSource instances via testCancellationTokenSource, causing the test to fail with a timeout error mid-run. When the timeout fires while the message pump is still running, the subsequent delivery calls SetResult on an already-faulted TCS, throwing InvalidOperationException. This propagates through the RabbitMQ pump as a processing error, triggering the onError Assert.Fail, which then escalates to the critical-error handler, producing three apparent failures from one root cause. - Raise TestTimeout from 60s to 5 minutes to accommodate the test's 3-minute design budget with margin for slower Windows CI runners - Change SetResult to TrySetResult to stop the cascade when a concurrent timeout and message delivery race Co-Authored-By: Claude Sonnet 4.6 --- src/ServiceControl.Transports.Tests/TransportTestFixture.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ServiceControl.Transports.Tests/TransportTestFixture.cs b/src/ServiceControl.Transports.Tests/TransportTestFixture.cs index 7c36817a98..0d4f82d592 100644 --- a/src/ServiceControl.Transports.Tests/TransportTestFixture.cs +++ b/src/ServiceControl.Transports.Tests/TransportTestFixture.cs @@ -185,7 +185,7 @@ protected Task CreateTestQueue(string queueName) return configuration.TransportCustomization.ProvisionQueues(transportSettings, []); } - protected static TimeSpan TestTimeout = TimeSpan.FromSeconds(60); + protected static TimeSpan TestTimeout = TimeSpan.FromMinutes(5); protected async Task SendAndReceiveMessages(string queueName, int numMessagesToIngest) { @@ -200,7 +200,7 @@ await StartQueueIngestor( if (numMessagesIngested == numMessagesToIngest) { - onMessagesProcessed.SetResult(true); + onMessagesProcessed.TrySetResult(true); } return Task.CompletedTask;