test(mtconnect): de-race the raised-count step-back test

The one-shot /sample failure was enqueued while the FIRST enumeration could still be
before its own one-shot check (the fake releases the call-count waiter first), so
under suite load the failure hit the first stream instead of the raised one
(intermittent). It is now enqueued after the first stream has consumed a chunk.

Refs #743

Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
Joseph Doherty
2026-10-22 16:35:34 -04:00
parent e03f343f14
commit edd2e23b7a
@@ -130,8 +130,11 @@ public sealed class MTConnectSampleLagTests
try
{
// The NEXT enumeration (the raised one) is refused the way a real Agent refuses a count above its buffer.
// Enqueued only once the first stream has consumed a chunk — i.e. is past its own one-shot-failure check —
// so the failure can only ever hit the raised stream (enqueueing earlier raced the first enumeration).
await client.PumpAsync(Chunk(Primed, 2, last: 900)).WaitAsync(Watchdog, Ct);
client.SampleFailures.Enqueue(new InvalidDataException("MTConnectError: INVALID_REQUEST count too large"));
for (var i = 0; i < 3; i++)
for (var i = 1; i < 3; i++)
await client.PumpAsync(Chunk(Primed + (2 * i), 2, last: 900)).WaitAsync(Watchdog, Ct);
await client.WaitForSampleCallsAsync(3).WaitAsync(Watchdog, Ct);