diff --git a/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Scripts/ScriptExecutionSchedulerTests.cs b/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Scripts/ScriptExecutionSchedulerTests.cs index 27997918..86ad91f0 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Scripts/ScriptExecutionSchedulerTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Scripts/ScriptExecutionSchedulerTests.cs @@ -60,7 +60,10 @@ public class ScriptExecutionSchedulerTests await WaitUntilAsync(() => scheduler.BusyThreadCount == 1); Assert.Equal(1, scheduler.QueueDepth); // second task waiting - Assert.True(scheduler.OldestBusyAge > TimeSpan.Zero); + // A busy thread reports a non-null age. Not asserting a strictly-positive + // value: Environment.TickCount64 has ~15 ms granularity, so under load the + // busy-timestamp and this read can fall in the same tick (age == Zero). + Assert.NotNull(scheduler.OldestBusyAge); gate.Set(); await Task.WhenAll(blocking, queued);