From e902aa8d46b91a6e6c97aa6686656d90825ef515 Mon Sep 17 00:00:00 2001 From: Aaron Stannard Date: Tue, 29 Sep 2026 19:58:52 +0000 Subject: [PATCH] De-flake HubsDocTests dynamic merge: async expectation with an explicit 10s timeout The test used the sync ExpectMsgAllOf with the 3s default. On a stalled Windows agent the first element reached the TestActor right at the deadline and the expectation threw OperationCanceledException. MergeHub always delivers both elements, so wait on them asynchronously with a 10s budget instead. --- src/core/Akka.Docs.Tests/Streams/HubsDocTests.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/Akka.Docs.Tests/Streams/HubsDocTests.cs b/src/core/Akka.Docs.Tests/Streams/HubsDocTests.cs index 99483bbbd50..1dee2393b96 100644 --- a/src/core/Akka.Docs.Tests/Streams/HubsDocTests.cs +++ b/src/core/Akka.Docs.Tests/Streams/HubsDocTests.cs @@ -29,7 +29,7 @@ public HubsDocTests(ITestOutputHelper output) } [Fact] - public void Hubs_must_demonstrate_creating_a_dynamic_merge() + public async Task Hubs_must_demonstrate_creating_a_dynamic_merge() { void WriteLine(string s) => TestActor.Tell(s); @@ -53,7 +53,10 @@ public void Hubs_must_demonstrate_creating_a_dynamic_merge() Source.Single("Hub!").RunWith(toConsumer, Materializer); #endregion - ExpectMsgAllOf(new []{ "Hello!", "Hub!"}); + // MergeHub queues producers that start before the hub stage does, so both + // elements always arrive; only the timing varies. The 3s default was too + // tight for three materializations on a stalled 2-vCPU CI agent. + await ExpectMsgAllOfAsync(TimeSpan.FromSeconds(10), new[] { "Hello!", "Hub!" }).ToListAsync(); } [Fact]