From 8089e9bb5b8a9d1389ca2cdf0c49616eb4accf9e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 8 Mar 2026 15:34:54 -0700 Subject: [PATCH] test: use t.Cleanup for bucket cleanup in group policy test --- test/s3/iam/s3_iam_group_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/s3/iam/s3_iam_group_test.go b/test/s3/iam/s3_iam_group_test.go index 82c03e877..d8784278f 100644 --- a/test/s3/iam/s3_iam_group_test.go +++ b/test/s3/iam/s3_iam_group_test.go @@ -346,9 +346,9 @@ func TestIAMGroupPolicyEnforcement(t *testing.T) { Bucket: aws.String(bucketName), }) require.NoError(t, err, "User with group policy should be allowed") - defer func() { + t.Cleanup(func() { userS3Client.DeleteBucket(&s3.DeleteBucketInput{Bucket: aws.String(bucketName)}) - }() + }) // Should also be able to put/get objects _, err = userS3Client.PutObject(&s3.PutObjectInput{