Browse Source

fix: add deferred user cleanup in TestIAMGroupUserDeletionSideEffect

Register t.Cleanup for the created user so it gets cleaned up
even if the test fails before the inline DeleteUser call.
pull/8560/head
Chris Lu 4 days ago
parent
commit
f46c74a3ca
  1. 4
      test/s3/iam/s3_iam_group_test.go

4
test/s3/iam/s3_iam_group_test.go

@ -567,6 +567,10 @@ func TestIAMGroupUserDeletionSideEffect(t *testing.T) {
_, err = iamClient.CreateUser(&iam.CreateUserInput{UserName: aws.String(userName)})
require.NoError(t, err)
t.Cleanup(func() {
// Best-effort: user may already be deleted by the test
iamClient.DeleteUser(&iam.DeleteUserInput{UserName: aws.String(userName)})
})
// Add user to group
_, err = iamClient.AddUserToGroup(&iam.AddUserToGroupInput{

Loading…
Cancel
Save