From 8c500d8170f31aa1f93a53ae7cd168345504b39c Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 17 Aug 2026 06:40:33 -0400 Subject: [PATCH] =?UTF-8?q?test(sitecallaudit):=20await=20the=20upsert=20a?= =?UTF-8?q?ssertions=20in=20SingleTimestampSaturation=20=E2=80=94=20gating?= =?UTF-8?q?=20on=20CallCount=20alone=20races=20the=20async=20repo=20write?= =?UTF-8?q?=20under=20parallel=20suite=20load=20(one=20full-suite=20failur?= =?UTF-8?q?e=20observed=202026-08-17;=203/3=20green=20in=20isolation;=20ro?= =?UTF-8?q?w-95=20fingerprint)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteCallAuditReconciliationTests.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/ZB.MOM.WW.ScadaBridge.SiteCallAudit.Tests/SiteCallAuditReconciliationTests.cs b/tests/ZB.MOM.WW.ScadaBridge.SiteCallAudit.Tests/SiteCallAuditReconciliationTests.cs index b94910fc..cd5acd5b 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.SiteCallAudit.Tests/SiteCallAuditReconciliationTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.SiteCallAudit.Tests/SiteCallAuditReconciliationTests.cs @@ -492,8 +492,17 @@ public class SiteCallAuditReconciliationTests : TestKit interval: TimeSpan.FromMilliseconds(50)); // The rows it saw were still upserted (idempotent mirror refresh). - Assert.True(repo.Upserted.ContainsKey(r1.TrackedOperationId)); - Assert.True(repo.Upserted.ContainsKey(r2.TrackedOperationId)); + // Awaited, not asserted flat: the upsert follows the pull asynchronously, + // so gating on CallCount alone races the repo write under parallel load + // (observed once in a full-suite run, 2026-08-17). + AwaitAssert( + () => + { + Assert.True(repo.Upserted.ContainsKey(r1.TrackedOperationId)); + Assert.True(repo.Upserted.ContainsKey(r2.TrackedOperationId)); + }, + duration: TimeSpan.FromSeconds(3), + interval: TimeSpan.FromMilliseconds(50)); // Critical SiteCallAudit-009 invariant: the within-tick drain BROKE on the // no-progress pin rather than looping to the 50-page ceiling. With a 2s