Skip to content

Commit 6cbddb8

Browse files
authored
Merge pull request #4077 from Skarlso/add_error_output
chore(ref): add output of error for role deletion
2 parents 492822d + ad1723c commit 6cbddb8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

test/e2e/shared/aws.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ func deleteResourcesInCloudFormation(prov client.ConfigProvider, t *cfn_bootstra
477477
By(fmt.Sprintf("cleanup for role with name '%s'", role.RoleName))
478478
Eventually(func(gomega Gomega) bool {
479479
_, err := iamSvc.DeleteRole(&iam.DeleteRoleInput{RoleName: aws.String(role.RoleName)})
480+
if err != nil {
481+
By(fmt.Sprintf("failed to delete role '%s'; reason: %s", role.RoleName, err.Error()))
482+
}
480483
return awserrors.IsNotFound(err) || err == nil
481484
}, 5*time.Minute, 5*time.Second).Should(BeTrue())
482485
}
@@ -485,6 +488,9 @@ func deleteResourcesInCloudFormation(prov client.ConfigProvider, t *cfn_bootstra
485488
By(fmt.Sprintf("cleanup for profile with name '%s'", profile.InstanceProfileName))
486489
Eventually(func(gomega Gomega) bool {
487490
_, err := iamSvc.DeleteInstanceProfile(&iam.DeleteInstanceProfileInput{InstanceProfileName: aws.String(profile.InstanceProfileName)})
491+
if err != nil {
492+
By(fmt.Sprintf("failed to delete role '%s'; reason: %s", profile.InstanceProfileName, err.Error()))
493+
}
488494
return awserrors.IsNotFound(err) || err == nil
489495
}, 5*time.Minute, 5*time.Second).Should(BeTrue())
490496
}
@@ -498,6 +504,9 @@ func deleteResourcesInCloudFormation(prov client.ConfigProvider, t *cfn_bootstra
498504
By(fmt.Sprintf("cleanup for policy '%s'", p.String()))
499505
Eventually(func(gomega Gomega) bool {
500506
_, err := iamSvc.DeletePolicy(&iam.DeletePolicyInput{PolicyArn: p.Arn})
507+
if err != nil {
508+
By(fmt.Sprintf("failed to delete policy '%s'; reason: %s", policy.Description, err.Error()))
509+
}
501510
return awserrors.IsNotFound(err) || err == nil
502511
}, 5*time.Minute, 5*time.Second).Should(BeTrue())
503512
// TODO: why is there a break here? Don't we want to clean up everything?

test/e2e/shared/suite.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ func Node1BeforeSuite(e2eCtx *E2EContext) []byte {
130130
e2eCtx.CloudFormationTemplate = renderCustomCloudFormation(bootstrapTemplate)
131131

132132
if !e2eCtx.Settings.SkipCloudFormationCreation {
133+
count := 0
133134
Eventually(func(gomega Gomega) bool {
135+
count++
136+
By(fmt.Sprintf("Trying to create CloudFormation stack... attempt %d", count))
134137
success := true
135138
if err := createCloudFormationStack(e2eCtx.AWSSession, bootstrapTemplate, bootstrapTags); err != nil {
136139
deleteCloudFormationStack(e2eCtx.AWSSession, bootstrapTemplate)

0 commit comments

Comments
 (0)