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
This commit is contained in:
Joseph Doherty
2026-11-11 10:36:49 -05:00
parent b46b20f8ed
commit 284358a2e2
@@ -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,