From dac224afe4c34f77eb13e609e56a362b6f8c89a8 Mon Sep 17 00:00:00 2001 From: yuwan Date: Tue, 24 Sep 2024 16:05:58 +0800 Subject: [PATCH] OCM-11406 | test: fix id: 74225 --- tests/e2e/test_rosacli_cluster.go | 4 ++-- tests/e2e/test_rosacli_policy.go | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/e2e/test_rosacli_cluster.go b/tests/e2e/test_rosacli_cluster.go index 1bb7536db0..35606a7abb 100644 --- a/tests/e2e/test_rosacli_cluster.go +++ b/tests/e2e/test_rosacli_cluster.go @@ -3146,12 +3146,12 @@ var _ = Describe("Reusing opeartor prefix and oidc config to create clsuter", la keysToUntag := []string{versionTagName} err = awsClient.UntagPolicy(operatorPolicyArn, keysToUntag) - Expect(err).To(BeNil()) + Expect(err).To(BeNil(), fmt.Sprintf("Expected no error, but got: %v", err)) tags := map[string]string{versionTagName: testingRoleVersion} err = awsClient.TagPolicy(operatorPolicyArn, tags) - Expect(err).To(BeNil()) + Expect(err).To(BeNil(), fmt.Sprintf("Expected no error, but got: %v", err)) By("Reuse operatot-role prefix and oidc config to create cluster with non-compatible version") diff --git a/tests/e2e/test_rosacli_policy.go b/tests/e2e/test_rosacli_policy.go index ebc7288f57..e04fdc73a7 100644 --- a/tests/e2e/test_rosacli_policy.go +++ b/tests/e2e/test_rosacli_policy.go @@ -344,14 +344,6 @@ var _ = Describe("Validation testing", err := rosaClient.CleanResources(clusterID) Expect(err).ToNot(HaveOccurred()) - By("Delete arbitrary policies") - if len(arbitraryPoliciesToClean) > 0 { - for _, policyArn := range arbitraryPoliciesToClean { - err = awsClient.DeletePolicy(policyArn) - Expect(err).To(BeNil()) - } - } - By("Delete the testing role") if len(testingRolesToClean) > 0 { for _, roleName := range testingRolesToClean { @@ -365,6 +357,14 @@ var _ = Describe("Validation testing", Expect(err).To(BeNil()) } } + + By("Delete arbitrary policies") + if len(arbitraryPoliciesToClean) > 0 { + for _, policyArn := range arbitraryPoliciesToClean { + err = awsClient.DeletePolicy(policyArn) + Expect(err).To(BeNil()) + } + } }) It("to check the validations for attaching and detaching arbitrary policies - [id:74225]", @@ -454,7 +454,7 @@ var _ = Describe("Validation testing", policyArnsWithTen := arbitraryPoliciesToClean[0:10] out, err = arbitraryPolicyService.AttachPolicy(supportRoleName, policyArnsWithTen, "--mode", "auto") Expect(err).NotTo(BeNil()) - Expect(out.String()).To(ContainSubstring("Failed to attach policies due to quota limitations (total limit: 10")) + Expect(out.String()).To(ContainSubstring("Cannot exceed quota for PoliciesPerRole: 10")) By("role has no red-hat-managed=true tag when attach") out, err = arbitraryPolicyService.AttachPolicy(notRHManagedRoleName, policyArns, "--mode", "auto") @@ -645,6 +645,7 @@ var _ = Describe("Account roles with attaching arbitrary policies", ContainSubstring("Attached policy '%s' to role '%s(%s)'", policyArn, roleName, roleUrlPrefix+roleName)) } } + By("Upgrade account-roles in auto mode") output, err = ocmResourceService.UpgradeAccountRole( "--prefix", aRolePrefix,