Skip to content

Commit

Permalink
OCM-10690 | test: updated id:34102
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraj7 committed Sep 10, 2024
1 parent 3b040bf commit 7e9ddbe
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/e2e/test_rosacli_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ var _ = Describe("Edit cluster",
rosaClient.Runner.UnsetFormat()
jsonData := rosaClient.Parser.JsonData.Input(jsonOutput).Parse()

By("Get OCM Environment")
rosaClient.Runner.JsonFormat()
userInfo, err := rosaClient.OCMResource.UserInfo()
Expect(err).To(BeNil())
rosaClient.Runner.UnsetFormat()
ocmApi := userInfo.OCMApi

By("Compare the text result with the json result")
Expect(CD.ID).To(Equal(jsonData.DigString("id")))
Expect(CD.ExternalID).To(Equal(jsonData.DigString("external_id")))
Expand All @@ -94,7 +101,13 @@ var _ = Describe("Edit cluster",

Expect(CD.State).To(Equal(jsonData.DigString("status", "state")))
Expect(CD.Created).NotTo(BeEmpty())
Expect(CD.DetailsPage).NotTo(BeEmpty())

By("Get details page console url")
consoleURL := common.GetConsoleUrlBasedOnEnv(ocmApi)
subscriptionID := jsonData.DigString("subscription", "id")
if consoleURL != "" {
Expect(CD.DetailsPage).To(Equal(consoleURL + subscriptionID))
}

if jsonData.DigBool("aws", "private_link") {
Expect(CD.Private).To(Equal("Yes"))
Expand Down
7 changes: 7 additions & 0 deletions tests/utils/common/constants/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ var JumpAccounts = map[string]string{
"production": "710019948333",
"staging": "644306948063",
}

const (
StageURL = "https://console.dev.redhat.com/openshift/details/s/"
ProductionURL = "https://console.redhat.com/openshift/details/s/"
StageEnv = "https://api.stage.openshift.com"
ProductionEnv = "https://api.openshift.com"
)
13 changes: 13 additions & 0 deletions tests/utils/common/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"crypto/rand"
"math/big"
"os"

"github.com/openshift/rosa/tests/utils/common/constants"
)

func ReadENVWithDefaultValue(envName string, fallback string) string {
Expand All @@ -20,3 +22,14 @@ func RandomInt(max int) int {
}
return int(val.Int64())
}

func GetConsoleUrlBasedOnEnv(ocmApi string) string {
switch ocmApi {
case constants.StageEnv:
return constants.StageURL
case constants.ProductionEnv:
return constants.ProductionURL
default:
return ""
}
}

0 comments on commit 7e9ddbe

Please sign in to comment.