diff --git a/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Scripts/ScriptCompilationServiceTests.cs b/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Scripts/ScriptCompilationServiceTests.cs index d654ff23..9d3b476c 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Scripts/ScriptCompilationServiceTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests/Scripts/ScriptCompilationServiceTests.cs @@ -43,8 +43,13 @@ public class ScriptCompilationServiceTests var r2 = _service.Compile("prestart-copy", "return 1 + 1;"); Assert.True(r1.IsSuccess); - Assert.Same(r1.CompiledScript, r2.CompiledScript); // one compile, shared Script (N4) - Assert.Equal(1, SiteScriptCompileCache.Hits); + Assert.Same(r1.CompiledScript, r2.CompiledScript); // one compile, shared Script (N4) — the definitive proof + // Hits is a process-global counter; other test classes in this assembly compile scripts + // concurrently (they are not in this serialized collection), so the exact post-Clear count + // is not deterministic under a full-assembly parallel run. The shared-Script assertion + // above is the real proof of cache reuse; here we only require the second lookup registered + // a hit (>= 1) rather than pinning an exact global count. + Assert.True(SiteScriptCompileCache.Hits >= 1); } [Fact]