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:
+30
-10
@@ -20,6 +20,7 @@ public sealed class ModbusSubscribeOptionsTests
|
||||
public ushort CurrentValue;
|
||||
public int WritesSent;
|
||||
public int FC06Count;
|
||||
public int ReadCount;
|
||||
/// <summary>Establishes a connection (no-op for testing).</summary>
|
||||
/// <param name="ct">The cancellation token.</param>
|
||||
public Task ConnectAsync(CancellationToken ct) => Task.CompletedTask;
|
||||
@@ -33,6 +34,8 @@ public sealed class ModbusSubscribeOptionsTests
|
||||
{
|
||||
case 0x03:
|
||||
{
|
||||
// Counted BEFORE CurrentValue is read, so a read counted after a step saw that step.
|
||||
Interlocked.Increment(ref ReadCount);
|
||||
var qty = (ushort)((pdu[3] << 8) | pdu[4]);
|
||||
var resp = new byte[2 + qty * 2];
|
||||
resp[0] = 0x03; resp[1] = (byte)(qty * 2);
|
||||
@@ -53,6 +56,27 @@ public sealed class ModbusSubscribeOptionsTests
|
||||
}
|
||||
/// <summary>Disposes the transport (no-op for testing).</summary>
|
||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
||||
|
||||
/// <summary>
|
||||
/// Step the register and wait until the poll loop has demonstrably observed it: two FC03 reads
|
||||
/// counted after the step. The first may be the one that read the new value; the poll loop is
|
||||
/// sequential, so the second cannot start until the first's publish has been raised. Replaces a
|
||||
/// fixed 150 ms sleep that, on a loaded CI runner, let a whole step go unpolled — the deadband
|
||||
/// test then saw [102, 107] or [100, 107] (#606).
|
||||
/// </summary>
|
||||
/// <param name="value">The new register value.</param>
|
||||
public async Task StepAndObserveAsync(ushort value)
|
||||
{
|
||||
CurrentValue = value;
|
||||
var target = Volatile.Read(ref ReadCount) + 2;
|
||||
var deadline = DateTime.UtcNow.AddSeconds(10);
|
||||
while (Volatile.Read(ref ReadCount) < target)
|
||||
{
|
||||
if (DateTime.UtcNow > deadline)
|
||||
throw new TimeoutException($"poll loop did not read register value {value} within 10 s");
|
||||
await Task.Delay(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Verifies that deadband filter suppresses changes below the threshold.</summary>
|
||||
@@ -73,14 +97,10 @@ public sealed class ModbusSubscribeOptionsTests
|
||||
var sub = await drv.SubscribeAsync(["Temp"], TimeSpan.FromMilliseconds(50), CancellationToken.None);
|
||||
try
|
||||
{
|
||||
fake.CurrentValue = 100;
|
||||
await Task.Delay(150);
|
||||
fake.CurrentValue = 102;
|
||||
await Task.Delay(150);
|
||||
fake.CurrentValue = 106;
|
||||
await Task.Delay(150);
|
||||
fake.CurrentValue = 107;
|
||||
await Task.Delay(150);
|
||||
await fake.StepAndObserveAsync(100);
|
||||
await fake.StepAndObserveAsync(102);
|
||||
await fake.StepAndObserveAsync(106);
|
||||
await fake.StepAndObserveAsync(107);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -112,8 +132,8 @@ public sealed class ModbusSubscribeOptionsTests
|
||||
var sub = await drv.SubscribeAsync(["Temp"], TimeSpan.FromMilliseconds(50), CancellationToken.None);
|
||||
try
|
||||
{
|
||||
fake.CurrentValue = 100; await Task.Delay(150);
|
||||
fake.CurrentValue = 101; await Task.Delay(150); // tiny change still publishes
|
||||
await fake.StepAndObserveAsync(100);
|
||||
await fake.StepAndObserveAsync(101); // tiny change still publishes
|
||||
}
|
||||
finally { await drv.UnsubscribeAsync(sub, CancellationToken.None); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user