@@ -477,22 +477,25 @@ var _ = Describe("Cluster Upgrade testing",
477
477
Expect (err ).To (BeNil ())
478
478
Expect (output .String ()).To (ContainSubstring ("Ensuring account role/policies compatibility for " +
479
479
"upgrade" ))
480
- Expect (output .String ()).To (ContainSubstring ("Starting to upgrade the policies" ))
481
-
482
- for _ , accountRoleName := range accountRoles {
483
- accountRolePolicyArns , err := awsClient .ListRoleAttachedPolicies (accountRoleName )
484
- Expect (err ).To (BeNil ())
485
- Expect (output .String ()).To (ContainSubstring ("Upgraded policy with ARN '%s' to version '%s'" ,
486
- * accountRolePolicyArns [0 ].PolicyArn , classicUpgradingMajorVersion ))
487
- }
480
+ Expect (output .String ()).To (SatisfyAny (
481
+ ContainSubstring ("Starting to upgrade the policies" ),
482
+ ContainSubstring ("are already up-to-date" ),
483
+ ))
488
484
Expect (output .String ()).To (ContainSubstring ("Ensuring operator role/policies compatibility for" +
489
485
" upgrade" ))
490
-
491
- for _ , operatorRoleName := range operatorRoles {
492
- operatorRolePolicyArns , err := awsClient .ListRoleAttachedPolicies (operatorRoleName )
493
- Expect (err ).To (BeNil ())
494
- Expect (output .String ()).To (ContainSubstring ("Upgraded policy with ARN '%s' to version '%s'" ,
495
- * operatorRolePolicyArns [0 ].PolicyArn , classicUpgradingMajorVersion ))
486
+ if strings .Contains (output .String (), "Starting to upgrade the policies" ) {
487
+ for _ , accountRoleName := range accountRoles {
488
+ accountRolePolicyArns , err := awsClient .ListRoleAttachedPolicies (accountRoleName )
489
+ Expect (err ).To (BeNil ())
490
+ Expect (output .String ()).To (ContainSubstring ("Upgraded policy with ARN '%s' to version '%s'" ,
491
+ * accountRolePolicyArns [0 ].PolicyArn , classicUpgradingMajorVersion ))
492
+ }
493
+ for _ , operatorRoleName := range operatorRoles {
494
+ operatorRolePolicyArns , err := awsClient .ListRoleAttachedPolicies (operatorRoleName )
495
+ Expect (err ).To (BeNil ())
496
+ Expect (output .String ()).To (ContainSubstring ("Upgraded policy with ARN '%s' to version '%s'" ,
497
+ * operatorRolePolicyArns [0 ].PolicyArn , classicUpgradingMajorVersion ))
498
+ }
496
499
}
497
500
}
498
501
})
@@ -599,9 +602,11 @@ var _ = Describe("Cluster Upgrade testing",
599
602
600
603
By ("Check account role version" )
601
604
for _ , accArn := range accRoles {
605
+ fmt .Println ("accArn: " , accArn )
602
606
parse , err := arn .Parse (accArn )
603
607
Expect (err ).To (BeNil ())
604
- accRoleName := strings .Split (parse .Resource , "/" )[1 ]
608
+ parts := strings .Split (parse .Resource , "/" )
609
+ accRoleName := parts [len (parts )- 1 ]
605
610
accRole , err := awsClient .GetRole (accRoleName )
606
611
Expect (err ).To (BeNil ())
607
612
for _ , tag := range accRole .Tags {
@@ -615,7 +620,8 @@ var _ = Describe("Cluster Upgrade testing",
615
620
for _ , opArn := range operatorRoles {
616
621
parse , err := arn .Parse (opArn )
617
622
Expect (err ).To (BeNil ())
618
- opRoleName := strings .Split (parse .Resource , "/" )[1 ]
623
+ parts := strings .Split (parse .Resource , "/" )
624
+ opRoleName := parts [len (parts )- 1 ]
619
625
opPolicy , err := awsClient .ListAttachedRolePolicies (opRoleName )
620
626
Expect (err ).To (BeNil ())
621
627
policyArn := * opPolicy [0 ].PolicyArn
0 commit comments