diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ConditionRefreshDeferralWireTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ConditionRefreshDeferralWireTests.cs index 29886a6bd..18cc6d003 100644 --- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ConditionRefreshDeferralWireTests.cs +++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests/ConditionRefreshDeferralWireTests.cs @@ -451,7 +451,11 @@ public sealed class ConditionRefreshDeferralWireTests }, stop.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default); var refusedAsInProgress = 0; - for (var r = 0; r < 40; r++) + // At least 40 refreshes, and keep going until the staller has actually caught deferral twice: under a loaded + // machine 40 refreshes can finish before any stall overlaps a report (the precondition below then failed on a + // run that tested nothing). The precondition is a presence wait, bounded by a generous ceiling. + var stressDeadline = DateTime.UtcNow + TimeSpan.FromSeconds(90); + for (var r = 0; r < 40 || (Volatile.Read(ref deferredSeen) <= 1 && DateTime.UtcNow < stressDeadline); r++) { var call = r % 3 == 2 ? serverSession.CallAsync(ObjectTypeIds.ConditionType, MethodIds.ConditionType_ConditionRefresh2, ct,