From 358fd314eaa424b480b92c43a3838eb20c6fb616 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 18 Aug 2026 18:34:01 -0700 Subject: [PATCH] test(s3/versioning): read the whole version body instead of one Read (#10815) A single Read on the response body can return the last bytes together with io.EOF, so asserting NoError on it fails even though the body is complete. Use io.ReadAll, like every other test in this package. --- .../s3/versioning/s3_versioning_pagination_stress_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/s3/versioning/s3_versioning_pagination_stress_test.go b/test/s3/versioning/s3_versioning_pagination_stress_test.go index 507427ff0..5da4f15f0 100644 --- a/test/s3/versioning/s3_versioning_pagination_stress_test.go +++ b/test/s3/versioning/s3_versioning_pagination_stress_test.go @@ -3,6 +3,7 @@ package s3api import ( "context" "fmt" + "io" "os" "strings" "testing" @@ -184,12 +185,11 @@ func TestVersioningPaginationOver1000Versions(t *testing.T) { }) require.NoError(t, err, "Failed to get version at index %d", idx) - buf := make([]byte, len(expectedContent)) - _, err = getResp.Body.Read(buf) - require.NoError(t, err) + body, err := io.ReadAll(getResp.Body) getResp.Body.Close() + require.NoError(t, err, "Failed to read version at index %d", idx) - assert.Equal(t, expectedContent, string(buf), "Content mismatch for version %d", idx+1) + assert.Equal(t, expectedContent, string(body), "Content mismatch for version %d", idx+1) } }) }