Skip to content

Commit

Permalink
OCM-10143 | test: fix ids:60688,59530,74761
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwang-RH committed Aug 5, 2024
1 parent ea34107 commit deac3c0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
27 changes: 19 additions & 8 deletions tests/e2e/test_rosacli_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1853,13 +1853,17 @@ var _ = Describe("Reusing opeartor prefix and oidc config to create clsuter", la
})

AfterEach(func() {
By("Recover the operator role policy version")
keysToUntag := []string{versionTagName}
err = awsClient.UntagPolicy(operatorPolicyArn, keysToUntag)
Expect(err).To(BeNil())
tags := map[string]string{versionTagName: originalMajorMinorVerson}
err = awsClient.TagPolicy(operatorPolicyArn, tags)
Expect(err).To(BeNil())
hostedCluster, err := clusterService.IsHostedCPCluster(clusterID)
Expect(err).ToNot(HaveOccurred())
if !hostedCluster {
By("Recover the operator role policy version")
keysToUntag := []string{versionTagName}
err = awsClient.UntagPolicy(operatorPolicyArn, keysToUntag)
Expect(err).To(BeNil())
tags := map[string]string{versionTagName: originalMajorMinorVerson}
err = awsClient.TagPolicy(operatorPolicyArn, tags)
Expect(err).To(BeNil())
}

By("Delete resources for testing")
output, err := ocmResourceService.DeleteOIDCConfig(
Expand Down Expand Up @@ -1895,6 +1899,11 @@ var _ = Describe("Reusing opeartor prefix and oidc config to create clsuter", la
rosalCommand.ReplaceFlagValue(map[string]string{
"-c": testClusterName,
})
if profile.ClusterConfig.DomainPrefixEnabled {
rosalCommand.ReplaceFlagValue(map[string]string{
"--domain-prefix": "dp60688",
})
}

By("Reuse the oidc config and operator-roles")
stdout, err := rosaClient.Runner.RunCMD(strings.Split(rosalCommand.GetFullCommand(), " "))
Expand Down Expand Up @@ -1923,7 +1932,9 @@ var _ = Describe("Reusing opeartor prefix and oidc config to create clsuter", la
Expect(err).To(BeNil())
operatorRolesArns := clusterDetail.OperatorIAMRoles

clusterVersion := clusterDetail.OpenshiftVersion
versionOutput, err := clusterService.GetClusterVersion(clusterID)
Expect(err).To(BeNil())
clusterVersion := versionOutput.RawID
major, minor, _, err := common.ParseVersion(clusterVersion)
Expect(err).To(BeNil())
originalMajorMinorVerson = fmt.Sprintf("%d.%d", major, minor)
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/test_rosacli_cluster_post.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,11 @@ var _ = Describe("Post-Check testing for cluster creation",
profile := profilehandler.LoadProfileYamlFileByENV()
Expect(err).ToNot(HaveOccurred())

By("Check if it is using oidc config")
if profile.ClusterConfig.OIDCConfig == "" {
Skip("Skip this case as it is only for byo oidc cluster")
}

By("Retrieve oidc config from cluster config")
clusterID = config.GetClusterID()
oidcConfigC = clusterConfig.Aws.Sts.OidcConfigID
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/test_rosacli_operator_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ var _ = Describe("Edit operator roles", labels.Feature.OperatorRoles, func() {
rosaClient *rosacli.Client
ocmResourceService rosacli.OCMResourceService
permissionsBoundaryArn string = "arn:aws:iam::aws:policy/AdministratorAccess"
clusterConfig *config.ClusterConfig
err error
)
BeforeEach(func() {
By("Init the client")
Expand All @@ -50,6 +52,10 @@ var _ = Describe("Edit operator roles", labels.Feature.OperatorRoles, func() {

By("Get the default dir")
defaultDir = rosaClient.Runner.GetDir()

By("Get cluster config")
clusterConfig, err = config.ParseClusterProfile()
Expect(err).ToNot(HaveOccurred())
})

AfterEach(func() {
Expand Down Expand Up @@ -105,6 +111,7 @@ var _ = Describe("Edit operator roles", labels.Feature.OperatorRoles, func() {
output, err = ocmResourceService.DeleteOIDCConfig(
"--oidc-config-id", oidcConfigID,
"--mode", "auto",
"--region", clusterConfig.Region,
"-y",
)
Expect(err).To(HaveOccurred())
Expand All @@ -114,6 +121,7 @@ var _ = Describe("Edit operator roles", labels.Feature.OperatorRoles, func() {
output, err = ocmResourceService.DeleteOIDCConfig(
"--oidc-config-id", oidcConfigID,
"--mode", "manual",
"--region", clusterConfig.Region,
"-y",
)
Expect(err).To(HaveOccurred())
Expand Down

0 comments on commit deac3c0

Please sign in to comment.