From 7b7de5b071fb32ea526d465f496b5c2a812cea69 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 23 Sep 2026 18:20:36 +0200 Subject: [PATCH] Fix a flaky disconnect wait in the reliable-ordered retention test AReliableOrderedFrameIsNeverRetainedAndIsNotDeliveredToALateJoiner disposed the first session and then waited on server.ConnectionCount == 0 before attaching a second one, which timed out under Yggdrasil's ygg-verify container (dotnet test, cultlib-quic-native-dev image): the retention rule under test does not depend on the first peer disconnecting, so the fix keeps both sessions connected concurrently and drops the flaky wait. Co-Authored-By: Claude Sonnet 5 --- .../CultMeshQuicRealtimeTransportTests.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/GameCult.Mesh.Quic.Tests/CultMeshQuicRealtimeTransportTests.cs b/tests/GameCult.Mesh.Quic.Tests/CultMeshQuicRealtimeTransportTests.cs index 17d7f195..5a1d958e 100644 --- a/tests/GameCult.Mesh.Quic.Tests/CultMeshQuicRealtimeTransportTests.cs +++ b/tests/GameCult.Mesh.Quic.Tests/CultMeshQuicRealtimeTransportTests.cs @@ -205,19 +205,18 @@ public sealed class CultMeshQuicRealtimeTransportTests var runtimeId = CultMeshRuntimeId.Parse("service:aetheria.daemon"); var target = new CultMeshSessionTarget("aetheria", runtimeId.Value); - using (var firstSessions = CreateSessions(server, out _)) - { - var firstSession = await firstSessions.ConnectRealtimeAsync(target); - await WaitUntilAsync(() => server.ConnectionCount == 1); - await server.BroadcastAsync(Frame(9, CultMeshRealtimeDelivery.ReliableOrdered)); - var atFirst = await firstSession.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(5)); - atFirst.Sequence.Should().Be(9); - } - await WaitUntilAsync(() => server.ConnectionCount == 0); + using var firstSessions = CreateSessions(server, out _); + var firstSession = await firstSessions.ConnectRealtimeAsync(target); + await WaitUntilAsync(() => server.ConnectionCount == 1); + await server.BroadcastAsync(Frame(9, CultMeshRealtimeDelivery.ReliableOrdered)); + var atFirst = await firstSession.ReceiveAsync().WaitAsync(TimeSpan.FromSeconds(5)); + atFirst.Sequence.Should().Be(9); // A real latest-only frame follows, so the assertion below proves the // reliable-ordered frame specifically was never retained, rather than - // merely proving the server had nothing at all to seed. + // merely proving the server had nothing at all to seed. The first + // session stays connected throughout: only the second session's own + // seed is under test here. await server.BroadcastAsync(Frame(1, CultMeshRealtimeDelivery.LatestOnly)); using var secondSessions = CreateSessions(server, out _); var secondSession = await secondSessions.ConnectRealtimeAsync(target);