Merge pull request #16558 from fuweid/34-backport-16268

[3.4] pkg/ioutil: deflake TestPageWriterRandom
This commit is contained in:
Benjamin Wang 2023-09-08 17:27:03 +01:00 committed by GitHub
commit e35bf9d957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,8 +37,8 @@ func TestPageWriterRandom(t *testing.T) {
if cw.writeBytes > n { if cw.writeBytes > n {
t.Fatalf("wrote %d bytes to io.Writer, but only wrote %d bytes", cw.writeBytes, n) t.Fatalf("wrote %d bytes to io.Writer, but only wrote %d bytes", cw.writeBytes, n)
} }
if n-cw.writeBytes > pageBytes { if maxPendingBytes := pageBytes + defaultBufferBytes; n-cw.writeBytes > maxPendingBytes {
t.Fatalf("got %d bytes pending, expected less than %d bytes", n-cw.writeBytes, pageBytes) t.Fatalf("got %d bytes pending, expected less than %d bytes", n-cw.writeBytes, maxPendingBytes)
} }
t.Logf("total writes: %d", cw.writes) t.Logf("total writes: %d", cw.writes)
t.Logf("total write bytes: %d (of %d)", cw.writeBytes, n) t.Logf("total write bytes: %d (of %d)", cw.writeBytes, n)