Skip to content

Commit 4d65c75

Browse files
committed
OCM-14323 | test: fix ids: 75445,64620
1 parent ed2a6e5 commit 4d65c75

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

tests/e2e/test_rosacli_oidc_config.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,13 @@ var _ = Describe("Register ummanaged oidc config testing",
233233
}
234234

235235
By("Cleanup created account-roles")
236-
_, err := ocmResourceService.DeleteAccountRole("--mode", "auto",
237-
"--prefix", accountRolePrefix,
238-
"-y")
239-
Expect(err).To(BeNil())
236+
if accountRolePrefix == "" {
237+
_, err := ocmResourceService.DeleteAccountRole("--mode", "auto",
238+
"--prefix", accountRolePrefix,
239+
"-y")
240+
Expect(err).To(BeNil())
241+
}
240242
})
241-
242243
It("to register successfully - [id:64620]", labels.High, labels.Runtime.OCMResources, func() {
243244
var (
244245
secretArn string
@@ -288,14 +289,21 @@ var _ = Describe("Register ummanaged oidc config testing",
288289
}
289290
if strings.Contains(command, "aws s3api create-bucket") {
290291
commandArgs = helper.ParseCommandToArgs(command)
292+
// Add '--output json' to the commandArgs
293+
jsonOutputArgs := []string{"--output", "json"}
294+
commandArgs = append(commandArgs, jsonOutputArgs...)
295+
291296
stdout, err := rosaClient.Runner.RunCMD(commandArgs)
292297
Expect(err).To(BeNil())
293298
re := regexp.MustCompile(`"Location":\s*"(http://[^"]+)"`)
294299
matches := re.FindStringSubmatch(stdout.String())
295300
if len(matches) > 1 {
296301
issuerUrl = strings.Replace(matches[1], "http://", "https://", 1)
297302
}
298-
Expect(issuerUrl).ToNot(BeEmpty(), "issuerUrl is empty which will block coming steps.")
303+
Expect(issuerUrl).ToNot(BeEmpty(),
304+
"extracted issuerUrl from %s is empty which will block coming steps.",
305+
stdout.String(),
306+
)
299307
continue
300308
}
301309
_, err := rosaClient.Runner.RunCMD(strings.Split(command, " "))

tests/e2e/test_rosacli_upgrade.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ var _ = Describe("Cluster Upgrade testing",
499499
}
500500
}
501501
})
502-
503502
It("to upgrade wide AMI roles with the managed policies in manual mode - [id:75445]",
504503
labels.Critical, labels.Runtime.Upgrade, func() {
505504
By("Check the cluster version and compare with the profile to decide if skip this case")
@@ -542,7 +541,7 @@ var _ = Describe("Cluster Upgrade testing",
542541
"policies. An upgrade isn't needed", resourcesHandler.GetOperatorRolesPrefix()))
543542
} else {
544543
By("Find STS Classic cluster upgrade version")
545-
classicUpgradingVersion, upgradingMajorVersion, err := clusterVersionList.FindUpperYStreamVersion(
544+
classicUpgradingVersion, _, err := clusterVersionList.FindUpperYStreamVersion(
546545
profile.ChannelGroup, clusterVersion)
547546
Expect(err).To(BeNil())
548547
if classicUpgradingVersion == "" {
@@ -601,6 +600,8 @@ var _ = Describe("Cluster Upgrade testing",
601600
Expect(err).To(BeNil())
602601

603602
By("Check account role version")
603+
expectedPolicyVersion, err := clusterVersionList.FindDefaultUpdatedPolicyVersion()
604+
Expect(err).To(BeNil())
604605
for _, accArn := range accRoles {
605606
fmt.Println("accArn: ", accArn)
606607
parse, err := arn.Parse(accArn)
@@ -611,7 +612,7 @@ var _ = Describe("Cluster Upgrade testing",
611612
Expect(err).To(BeNil())
612613
for _, tag := range accRole.Tags {
613614
if *tag.Key == versionTagName {
614-
Expect(*tag.Value).To(Equal(upgradingMajorVersion))
615+
Expect(*tag.Value).To(Equal(expectedPolicyVersion))
615616
}
616617
}
617618
}
@@ -629,7 +630,7 @@ var _ = Describe("Cluster Upgrade testing",
629630
Expect(err).To(BeNil())
630631
for _, tag := range policy.Tags {
631632
if *tag.Key == versionTagName {
632-
Expect(*tag.Value).To(Equal(upgradingMajorVersion))
633+
Expect(*tag.Value).To(Equal(expectedPolicyVersion))
633634
}
634635
}
635636
}

tests/utils/exec/rosacli/version_service.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,3 +469,15 @@ func (vl *OpenShiftVersionTableList) FindUpperYStreamVersion(channelGroup string
469469
return upgradingVersion, upgradingMajorVersion, nil
470470
}
471471
}
472+
473+
// This function will find the expected version of IAM roles after manual upgrade
474+
// The version actually is the mayjor version of the latest cluster version
475+
func (vl *OpenShiftVersionTableList) FindDefaultUpdatedPolicyVersion() (string, error) {
476+
sortedVersionList, err := vl.Sort(true)
477+
if err != nil {
478+
return "", err
479+
}
480+
latestVersionFromOutput := sortedVersionList.OpenShiftVersions[0].Version
481+
latestMajorVersion := helper.SplitMajorVersion(latestVersionFromOutput)
482+
return latestMajorVersion, nil
483+
}

0 commit comments

Comments
 (0)