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 {