test(fetchguard): widen streaming-cap ceiling to stop flake under parallel runs

TestFetchTooLargeIsStreaming asserted the server wrote at most 64 KiB, but
the handler keeps flushing 64-byte chunks until the client's close propagates,
which under a loaded full-suite run exceeds that (observed ~80 KiB). The
assertion guards against unbounded buffering toward 8 MiB, so 1 MiB keeps
the intent and removes the flake.
This commit is contained in:
Jakub Zych
2026-09-23 21:15:43 +02:00
parent 7f37311120
commit 64f9009d3d

View File

@@ -183,9 +183,12 @@ func TestFetchTooLargeIsStreaming(t *testing.T) {
if reasonFrom(t, err) != ReasonTooLarge {
t.Fatalf("reason = %q, want %s", reasonFrom(t, err), ReasonTooLarge)
}
// TCP/HTTP buffering can write a little past maxBytes+1; the client must
// not have pulled an unbounded body first (the handler would hit 8MiB).
if got := written.Load(); got > 64<<10 {
// TCP/HTTP buffering can write past maxBytes+1, and under a loaded parallel
// test run the handler keeps flushing 64-byte chunks until the client's
// close propagates (observed ~80 KiB). The client must not have pulled an
// unbounded body first (the handler would hit 8 MiB), so 1 MiB is the
// meaningful ceiling.
if got := written.Load(); got > 1<<20 {
t.Fatalf("server wrote %d bytes, client appears to have buffered unbounded body", got)
}
if written.Load() < maxBytes+1 {