diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests/DataConnections/GrpcDataProjectedConditionAccessTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests/DataConnections/GrpcDataProjectedConditionAccessTests.cs index 2af8ac958..7e023176a 100644 --- a/tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests/DataConnections/GrpcDataProjectedConditionAccessTests.cs +++ b/tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests/DataConnections/GrpcDataProjectedConditionAccessTests.cs @@ -1033,7 +1033,13 @@ public sealed class GrpcDataProjectedConditionAccessTests [Fact] public async Task R2_S2_a_hold_that_never_settles_goes_stale_then_is_released_past_MaxHold() { - await using var f = new Fixture(Fixture.DefaultOptions with { MaxHold = TimeSpan.FromMilliseconds(600) }, ("map-a", DataRealm.Raw, 10)); + // #1057 (flake, test timing — not a production defect): the stale mark is armed only once the held runner's loop has + // unwound (so no late Good from that loop can follow it), then fires 100 ms later; MaxHold runs from the hold itself. + // With MaxHold = 600 ms the test relied on the loop unwinding within ~500 ms. Measured with the thread pool saturated + // (as in a full parallel Runtime.Tests run): the stale mark landed ~1.9 s after the hold while the release fired at + // ~0.9 s — the release ends the hold first, so the stale mark is skipped (or the test's later check sees the removal). + // Production keeps minutes of margin (MaxHold 5 min). 5 s keeps the ordering under that load (~3 s of margin). + await using var f = new Fixture(Fixture.DefaultOptions with { MaxHold = TimeSpan.FromSeconds(5) }, ("map-a", DataRealm.Raw, 10)); using var demand = f.Access.AcquireEventDemand(null); await CompleteFirstAsync(f, ("map-a", [Record(Key("x"), 3)])); await f.WaitAsync(() => f.Sink.Live.Count == 1);