Skip to content

Commit ca7bd21

Browse files
authored
r/aws_iam_role_policy_attachments_exclusive(test): fix test configuration (#39729)
During a refactor of the initial implementation, the `Config` field was updated during the first test step but not the second. This introduced a race condition between detachment and deletion of the out of band policy, resulting in intermittent failures deleting the policy. The impacted test now appropriately uses the same configuration throughout all test steps. ```console % make testacc PKG=iam TESTS=TestAccIAMRolePolicyAttachmentsExclusive_ make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.23.2 test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMRolePolicyAttachmentsExclusive_' -timeout 360m 2024/10/15 13:56:16 Initializing Terraform AWS Provider... --- PASS: TestAccIAMRolePolicyAttachmentsExclusive_empty (15.49s) --- PASS: TestAccIAMRolePolicyAttachmentsExclusive_disappears_Role (17.15s) --- PASS: TestAccIAMRolePolicyAttachmentsExclusive_disappears_Policy (17.45s) --- PASS: TestAccIAMRolePolicyAttachmentsExclusive_basic (17.85s) --- PASS: TestAccIAMRolePolicyAttachmentsExclusive_outOfBandAddition (25.47s) --- PASS: TestAccIAMRolePolicyAttachmentsExclusive_outOfBandRemoval (25.58s) --- PASS: TestAccIAMRolePolicyAttachmentsExclusive_multiple (25.99s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/iam 31.059s ```
1 parent 0e4ee68 commit ca7bd21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/service/iam/role_policy_attachments_exclusive_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func TestAccIAMRolePolicyAttachmentsExclusive_outOfBandAddition(t *testing.T) {
273273
ExpectNonEmptyPlan: true,
274274
},
275275
{
276-
Config: testAccRolePolicyAttachmentsExclusiveConfig_basic(rName),
276+
Config: testAccRolePolicyAttachmentsExclusiveConfig_outOfBandAddition(rName, oobPolicyName),
277277
Check: resource.ComposeTestCheckFunc(
278278
testAccCheckRoleExists(ctx, roleResourceName, &role),
279279
testAccCheckRolePolicyAttachmentsExclusiveExists(ctx, resourceName),

0 commit comments

Comments
 (0)