test(WRK-21): size the byte-heavy drain fixture for the pipe harness
ci / java (push) Successful in 2m12s
ci / portable (push) Successful in 8m23s
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Failing after 11m46s

PipePair has no continuous read pump — the test thread drains the pipe only
while it sits in ReadUntilAsync — so multi-megabyte DrainEvents frames
interleaved with the heartbeat loop wedge both ends inside FlushFileBuffers,
each waiting for the other to read. Negotiate a 128 KiB frame maximum instead:
the 10,000 byte-heavy events still overflow it many times over, so every
assertion (bounded reply, reported truncation, no event loss across repeated
drains, surviving session) is unchanged.
This commit is contained in:
Joseph Doherty
2026-08-07 06:25:15 -04:00
parent 33ba612ddd
commit 7c2eaf09e2
@@ -20,12 +20,17 @@ public sealed class WorkerPipeSessionTests
private const string Nonce = "nonce-secret";
// Byte-heavy drain fixture (WRK-21). 10,000 events at ~1.7 KiB each is ~17 MB of queue — far
// more than one frame — so DrainEvents must split across replies. The negotiated frame maximum
// is deliberately smaller than the compile-time default so the split happens in a handful of
// multi-MB frames instead of moving 17 MB through the test pipe.
// more than one frame — so DrainEvents must split across replies.
//
// The negotiated frame maximum is deliberately small. What is under test is the byte cap, and
// it behaves identically at any frame size, but this harness is not the production gateway:
// PipePair has no continuous read pump, so the test thread only drains the pipe while it sits
// in ReadUntilAsync. Multi-megabyte frames interleaved with the heartbeat loop can therefore
// wedge both ends inside FlushFileBuffers, each waiting for the other to read. A frame maximum
// well under the pipe buffer keeps the harness honest without weakening a single assertion.
private const int ByteHeavyEventCount = 10_000;
private const int ByteHeavyEventPayloadBytes = 1_800;
private const uint NegotiatedMaxFrameBytes = 2 * 1024 * 1024;
private const uint NegotiatedMaxFrameBytes = 128 * 1024;
/// <summary>Verifies that valid gateway hello triggers worker hello and ready responses.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
@@ -611,7 +616,7 @@ public sealed class WorkerPipeSessionTests
recovered.Add(drained.WorkerSequence);
}
Assert.True(replyCount < 100, "DrainEvents made no progress across 100 replies.");
Assert.True(replyCount < 1_000, "DrainEvents made no progress across 1,000 replies.");
}
// More than one reply proves the drain really split; every event came back exactly once, in