ci(#606): Gitea-compatible trx upload + deterministic fixes for the CI-load test flakes
- v2-ci.yml: upload-artifact@v4 -> @v3 + continue-on-error (act_runner reports as GHES and v4 refuses GHES, failing every run); runner-capacity diagnostic step; AKKA_TEST_TIMEFACTOR=3 on the test step. - Runtime/ControlPlane harnesses: akka.test.timefactor from AKKA_TEST_TIMEFACTOR (TestTimeFactor), single-expect-default 15s; ControlPlane gains PresenceBudget. - Leaked spinner threads: the infinite-loop timeout tests (Calculation, Host.IntegrationTests RoslynVirtualTagEvaluator, 3x Core.Scripting) pinned a core for the rest of the test process (abandoned, never stopped). Now a bounded 5 s wall-clock spin; outer compile-inclusive bound 30 s. - Real test races fixed: ScriptedAlarmEngine push-during-drain (Inactive is also the start state + persist-before-update => wait for the Cleared save); DriverReconnectE2e (both nodes host the driver; Created[] is last-writer-wins and ForceReconnect is a no-op while Connecting); ControlPlaneStarterOrder (lost-race heal waited for a 60 s refresh tick). - Fixed sleeps -> poll-for-condition: ReconnectSupervisor LastError, Modbus deadband steps (wait for observed reads), Modbus dispose hygiene precondition, FOCAS probe-loop log. - Short presence budgets -> PresenceBudget in the Runtime/ControlPlane tests seen failing on Gitea; Calculation Settle 10 -> 30 s. No assertion removed, nothing skipped. - infra/README.md §10 CI; stale TreatWarningsAsErrors comment in Directory.Build.props. Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
@@ -1183,6 +1183,23 @@ public sealed class ScriptedAlarmEngineTests
|
||||
throw new TimeoutException("Condition did not become true in time");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Waits for a blocked-Activated-save scenario to finish its follow-up pass: the Cleared transition
|
||||
/// has been persisted (the second SaveAsync) AND applied in memory.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Waiting for <c>Active == Inactive</c> alone is ambiguous here — Inactive is also the state the
|
||||
/// alarm STARTED in, and the engine persists BEFORE it updates memory, so in the instant after the
|
||||
/// gate is released the in-memory state still reads the pre-activation Inactive. The wait then
|
||||
/// returned before the follow-up pass ran and the evaluation count read 1 (#606, a Gitea CI failure
|
||||
/// in 137 ms). <see cref="CountingAlarmStateStore.SaveCount"/> counts at SaveAsync entry, so
|
||||
/// "two saves started AND Inactive in memory" is only true after the Cleared update.
|
||||
/// </remarks>
|
||||
private static Task WaitForClearedFollowUpAsync(ScriptedAlarmEngine eng, CountingAlarmStateStore store) =>
|
||||
WaitForAsync(
|
||||
() => store.SaveCount >= 2 && eng.GetState("A")!.Active == AlarmActiveState.Inactive,
|
||||
timeoutMs: 3000);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Test helpers
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -1486,7 +1503,7 @@ public sealed class ScriptedAlarmEngineTests
|
||||
up.Push("Temp", 50);
|
||||
|
||||
saveGate.SetResult();
|
||||
await WaitForAsync(() => eng.GetState("A")!.Active == AlarmActiveState.Inactive, timeoutMs: 3000);
|
||||
await WaitForClearedFollowUpAsync(eng, store);
|
||||
|
||||
probe.Count.ShouldBeLessThanOrEqualTo(2,
|
||||
"11 pushes over one blocked evaluation must produce the in-flight evaluation plus at " +
|
||||
@@ -1529,7 +1546,9 @@ public sealed class ScriptedAlarmEngineTests
|
||||
await eng.LoadAsync([
|
||||
Alarm("A", """ctx.Logger.Information("EVALPROBE"); return (int)ctx.GetTag("Temp").Value > 100;"""),
|
||||
], TestContext.Current.CancellationToken);
|
||||
// LoadAsync evaluates AND saves once (startup recovery) — count both from here.
|
||||
probe.Reset();
|
||||
store.ResetCount();
|
||||
|
||||
var saveGate = new TaskCompletionSource();
|
||||
store.BlockNextSave = saveGate;
|
||||
@@ -1542,7 +1561,7 @@ public sealed class ScriptedAlarmEngineTests
|
||||
up.Push("Temp", 40);
|
||||
saveGate.SetResult();
|
||||
|
||||
await WaitForAsync(() => eng.GetState("A")!.Active == AlarmActiveState.Inactive, timeoutMs: 3000);
|
||||
await WaitForClearedFollowUpAsync(eng, store);
|
||||
probe.Count.ShouldBe(2, "the in-flight pass plus exactly one follow-up pass for the late push");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user