From 64f9009d3d08ac7f699ea899562ab5e3b7b65912 Mon Sep 17 00:00:00 2001 From: Jakub Zych Date: Wed, 23 Sep 2026 21:15:43 +0200 Subject: [PATCH] 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. --- fetchguard/fetch_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fetchguard/fetch_test.go b/fetchguard/fetch_test.go index 300b846..41d7520 100644 --- a/fetchguard/fetch_test.go +++ b/fetchguard/fetch_test.go @@ -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 {