@@ -520,6 +520,18 @@ func deleteResourcesInCloudFormation(prov client.ConfigProvider, t *cfn_bootstra
520520 return err == nil || (ok && code == iam .ErrCodeNoSuchEntityException )
521521 }, 5 * time .Minute , 5 * time .Second ).Should (BeTrue ())
522522 }
523+ for _ , group := range groups {
524+ repeat := false
525+ Eventually (func (gomega Gomega ) bool {
526+ _ , err := iamSvc .DeleteGroup (& iam.DeleteGroupInput {GroupName : aws .String (group .GroupName )})
527+ if err != nil && ! repeat {
528+ By (fmt .Sprintf ("failed to delete group '%s'; reason: %+v" , group .GroupName , err ))
529+ repeat = true
530+ }
531+ code , ok := awserrors .Code (err )
532+ return err == nil || (ok && code == iam .ErrCodeNoSuchEntityException )
533+ }, 5 * time .Minute , 5 * time .Second ).Should (BeTrue ())
534+ }
523535 for _ , policy := range policies {
524536 policies , err := iamSvc .ListPolicies (& iam.ListPoliciesInput {})
525537 Expect (err ).NotTo (HaveOccurred ())
@@ -545,18 +557,6 @@ func deleteResourcesInCloudFormation(prov client.ConfigProvider, t *cfn_bootstra
545557 }
546558 }
547559 }
548- for _ , group := range groups {
549- repeat := false
550- Eventually (func (gomega Gomega ) bool {
551- _ , err := iamSvc .DeleteGroup (& iam.DeleteGroupInput {GroupName : aws .String (group .GroupName )})
552- if err != nil && ! repeat {
553- By (fmt .Sprintf ("failed to delete group '%s'; reason: %+v" , group .GroupName , err ))
554- repeat = true
555- }
556- code , ok := awserrors .Code (err )
557- return err == nil || (ok && code == iam .ErrCodeNoSuchEntityException )
558- }, 5 * time .Minute , 5 * time .Second ).Should (BeTrue ())
559- }
560560}
561561
562562// TODO: remove once test infra accounts are fixed.
0 commit comments