From 284358a2e2bca407b287a2411f4a54e5dffd4147 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Wed, 11 Nov 2026 10:36:49 -0500 Subject: [PATCH] test(opcua): ConditionRefresh stress runs until deferral was actually exercised (#838 follow-on) Under load 40 refreshes could finish before any stall overlapped a report, failing the 'stress must have run with deferred events' precondition. Keep refreshing (>=40, ceiling 90 s) until deferral is seen. Claude-Session: https://claude.ai/code/session_01GT67AD99zQQqpLCVm3p7xk --- .../ConditionRefreshDeferralWireTests.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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,