From 40f06314fb1921b5b8cda6625349c94383a73aa1 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 22 May 2026 07:06:27 -0400 Subject: [PATCH] test(virtual-tags): unbreak script-timeout test after sandbox deny-list change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Timeout_maps_to_BadInternalError_without_killing_the_engine test's "Hang" script busy-looped on Environment.TickCount64. Commit cfb9ff1 (Core.Scripting-001) added System.Environment to the script-sandbox deny-list, so the script now fails sandbox validation instead of reaching the timeout path. Switch the busy-loop to DateTime.UtcNow (an allowed type) to preserve the test's intent — a self-terminating ~5s hang that overruns the 30ms script timeout. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../VirtualTagEngineTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.VirtualTags.Tests/VirtualTagEngineTests.cs b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.VirtualTags.Tests/VirtualTagEngineTests.cs index cf252d1..6e76019 100644 --- a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.VirtualTags.Tests/VirtualTagEngineTests.cs +++ b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.VirtualTags.Tests/VirtualTagEngineTests.cs @@ -140,8 +140,8 @@ public sealed class VirtualTagEngineTests engine.Load([ new VirtualTagDefinition("Hang", DriverDataType.Int32, """ - var end = Environment.TickCount64 + 5000; - while (Environment.TickCount64 < end) { } + var end = DateTime.UtcNow.AddSeconds(5); + while (DateTime.UtcNow < end) { } return 1; """), new VirtualTagDefinition("Ok", DriverDataType.Int32, """return 42;"""),