From b2ec00558a1af6df73248eed98e027935bd0f117 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 4 Mar 2026 11:32:55 -0800 Subject: [PATCH] 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 --- test/s3/normal/get_object_attributes_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/s3/normal/get_object_attributes_test.go b/test/s3/normal/get_object_attributes_test.go index 4740f0854..743a3f03a 100644 --- a/test/s3/normal/get_object_attributes_test.go +++ b/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 }