From db5ad02cc9fca56b30d3b5ab394f957e4043d9d1 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 9 Jul 2026 00:33:40 -0400 Subject: [PATCH] =?UTF-8?q?test(site-runtime):=20harden=20scheduler=20Olde?= =?UTF-8?q?stBusyAge=20gauge=20assertion=20=E2=80=94=20assert=20non-null,?= =?UTF-8?q?=20not=20strictly-positive=20(TickCount64=20~15ms=20granularity?= =?UTF-8?q?=20flakes=20under=20load)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/ScriptExecutionSchedulerTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);