Skip to content

Commit cc42b64

Browse files
committed
OCM-13495 | test: fix ids: 57410,57444,75445,75603,75534
1 parent 5f49c6e commit cc42b64

File tree

3 files changed

+45
-7
lines changed

3 files changed

+45
-7
lines changed

tests/e2e/test_rosacli_cluster.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"strings"
1212
"time"
1313

14+
"k8s.io/apimachinery/pkg/util/wait"
15+
1416
"github.com/aws/aws-sdk-go-v2/aws"
1517
"github.com/aws/aws-sdk-go-v2/service/iam"
1618
. "github.com/onsi/ginkgo/v2"
@@ -3499,6 +3501,25 @@ var _ = Describe("Sts cluster creation with external id",
34993501
})
35003502
Expect(err).To(BeNil())
35013503

3504+
By("Wait for the trust relationship to be updated")
3505+
err = wait.PollUntilContextTimeout(
3506+
context.Background(),
3507+
20*time.Second,
3508+
300*time.Second,
3509+
false,
3510+
func(context.Context) (bool, error) {
3511+
result, err := awsClient.IamClient.GetRole(context.TODO(), &iam.GetRoleInput{
3512+
RoleName: aws.String(roleName),
3513+
})
3514+
3515+
if strings.Contains(*result.Role.AssumeRolePolicyDocument, ExternalId) {
3516+
return true, nil
3517+
}
3518+
3519+
return false, err
3520+
})
3521+
Expect(err).To(BeNil())
3522+
35023523
By("Create cluster with external id not same with the role setting one")
35033524
notMatchExternalId := "333B9588-36A5-ECA4-BE8D-7C673B77CDCD"
35043525
rosalCommand.AddFlags("--external-id", notMatchExternalId)
@@ -3660,7 +3681,7 @@ var _ = Describe("HCP cluster creation supplemental testing",
36603681
Eventually(func() (string, error) {
36613682
output, err := clusterService.InstallLog(clusterName)
36623683
return output.String(), err
3663-
}, time.Minute*5, time.Second*10).Should(And(
3684+
}, time.Minute*10, time.Second*30).Should(And(
36643685
ContainSubstring("hostedclusters %s Version", clusterName),
36653686
ContainSubstring("hostedclusters %s Release image is valid", clusterName)))
36663687

@@ -3680,7 +3701,7 @@ var _ = Describe("HCP cluster creation supplemental testing",
36803701
Eventually(func() (string, error) {
36813702
output, err := clusterService.UnInstallLog(clusterName)
36823703
return output.String(), err
3683-
}, time.Minute*2, time.Second*10).
3704+
}, time.Minute*20, time.Second*30).
36843705
Should(
36853706
ContainSubstring("hostedclusters %s Reconciliation completed successfully", clusterName))
36863707

tests/e2e/test_rosacli_cluster_post.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,19 @@ var _ = Describe("Post-Check testing for cluster creation",
930930
By("Check policy is aws managed policy")
931931
attachedPolicies, err := awsClient.ListAttachedRolePolicies(operatorRoleName)
932932
Expect(err).To(BeNil())
933-
Expect(*attachedPolicies[0].PolicyArn).To(ContainSubstring("arn:aws:iam::aws"), operatorRoleName)
933+
934+
if len(attachedPolicies) > 1 {
935+
managedPolicyFound := false
936+
for _, policy := range attachedPolicies {
937+
if strings.Contains(*policy.PolicyArn, "arn:aws:iam::aws") {
938+
managedPolicyFound = true
939+
break
940+
}
941+
}
942+
Expect(managedPolicyFound).To(BeTrue())
943+
} else {
944+
Expect(*attachedPolicies[0].PolicyArn).To(ContainSubstring("arn:aws:iam::aws"), operatorRoleName)
945+
}
934946
}
935947
})
936948
})

tests/e2e/test_rosacli_upgrade.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,16 @@ var _ = Describe("Cluster Upgrade testing",
6060

6161
AfterEach(func() {
6262
if profile.Version == constants.YStreamPreviousVersion {
63-
By("Delete cluster upgrade")
64-
output, err := upgradeService.DeleteUpgrade("-c", clusterID, "-y")
63+
By("Delete cluster upgrade if there is some scheduled upgrade existed")
64+
output, err := upgradeService.DescribeUpgrade(clusterID)
6565
Expect(err).ToNot(HaveOccurred())
66-
Expect(output.String()).To(ContainSubstring(
67-
"Successfully canceled scheduled upgrade on cluster '%s'", clusterID))
66+
if !strings.Contains(output.String(), "No scheduled upgrades for cluster") {
67+
output, err = upgradeService.DeleteUpgrade("-c", clusterID, "-y")
68+
Expect(err).ToNot(HaveOccurred())
69+
Expect(output.String()).To(ContainSubstring(
70+
"Successfully canceled scheduled upgrade on cluster '%s'", clusterID))
71+
}
72+
6873
}
6974

7075
By("Clean remaining resources")

0 commit comments

Comments
 (0)