Browse Source

s3api: use bounded HTTP client in GetObjectAttributes tests

Replace http.DefaultClient with a timeout-aware http.Client (10s) in
the signedGetObjectAttributes helper and testGetObjectAttributesInvalid
to prevent tests from hanging indefinitely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pull/8504/head
Chris Lu 1 day ago
parent
commit
b2ec00558a
  1. 6
      test/s3/normal/get_object_attributes_test.go

6
test/s3/normal/get_object_attributes_test.go

@ -254,7 +254,8 @@ func testGetObjectAttributesInvalid(t *testing.T, cluster *TestCluster) {
_, err = signer.Sign(req, nil, "s3", testRegion, time.Now())
require.NoError(t, err)
resp, err := http.DefaultClient.Do(req)
client := &http.Client{Timeout: 10 * time.Second}
resp, err := client.Do(req)
require.NoError(t, err)
defer resp.Body.Close()
io.Copy(io.Discard, resp.Body)
@ -364,7 +365,8 @@ func signedGetObjectAttributes(t *testing.T, cluster *TestCluster, bucketName, o
signer := v1signer.NewSigner(v1credentials.NewStaticCredentials(testAccessKey, testSecretKey, ""))
_, err = signer.Sign(req, nil, "s3", testRegion, time.Now())
require.NoError(t, err)
resp, err := http.DefaultClient.Do(req)
client := &http.Client{Timeout: 10 * time.Second}
resp, err := client.Do(req)
require.NoError(t, err)
return resp
}

Loading…
Cancel
Save