Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip #91

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

wip #91

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions tests/e2e/openshift_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
package e2e

import (
"github.com/blang/semver"
"fmt"

"github.com/blang/semver"

Check failure on line 21 in tests/e2e/openshift_upgrade_test.go

View workflow job for this annotation

GitHub Actions / Run linters

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/cloudnative-pg/cloudnative-pg) -s blank -s dot (gci)
"github.com/cloudnative-pg/cloudnative-pg/tests"
testsUtils "github.com/cloudnative-pg/cloudnative-pg/tests/utils"

Expand All @@ -34,12 +35,11 @@
sampleFile = fixturesDir + "/base/cluster-storage-class.yaml.template"
)

var ocp412 semver.Version
var ocp413 semver.Version
var ocpVersion semver.Version
var err error

BeforeAll(func() {
Skip("Disable until a new fix is compatible")
})

BeforeEach(func() {
Expand All @@ -50,7 +50,7 @@
Skip("This test case is only applicable on OpenShift clusters")
}
// Setup OpenShift Versions
ocp412, err = semver.Make("4.12.0")
ocp413, err = semver.Make("4.13.0")
Expect(err).ToNot(HaveOccurred())
// Get current OpenShift Versions
ocpVersion, err = testsUtils.GetOpenshiftVersion(env)
Expand Down Expand Up @@ -122,15 +122,22 @@
// Apply a subscription in the openshift-operators namespace.
// This should create the operator
By("Applying the initial subscription", func() {
err := testsUtils.CreateSubscription(env, initialSubscription)
Expect(err).ToNot(HaveOccurred())
if initialSubscription != "stable-v1" {
err := testsUtils.CreateSubscription(env, initialSubscription)
Expect(err).ToNot(HaveOccurred())
}

AssertOperatorIsReady()
})

subScription, err := testsUtils.GetSubscription(env)

Check failure on line 133 in tests/e2e/openshift_upgrade_test.go

View workflow job for this annotation

GitHub Actions / Run linters

ineffectual assignment to err (ineffassign)
GinkgoWriter.Printf("subScription is %v", subScription)
// Gather the version and semantic Versions of the operator
currentVersion, err := testsUtils.GetSubscriptionVersion(env)
GinkgoWriter.Printf("currentVersion is %v", currentVersion)
Expect(err).ToNot(HaveOccurred())
currentSemVersion, err := semver.Make(currentVersion)
GinkgoWriter.Printf("currentSemVersion is %v", currentSemVersion)
Expect(err).ToNot(HaveOccurred())
newPolicyRelease, err := semver.Make("1.16.0")
Expect(err).ToNot(HaveOccurred())
Expand All @@ -152,6 +159,8 @@
// Apply the new subscription to upgrade to a new version of the operator
err = testsUtils.UpgradeSubscription(env, upgradeSubscription)
Expect(err).ToNot(HaveOccurred())
subScription, err = testsUtils.GetSubscription(env)
GinkgoWriter.Printf("subScription is %v", subScription)
Eventually(func() (string, error) {
return testsUtils.GetSubscriptionVersion(env)
}, 300).
Expand All @@ -165,8 +174,8 @@
}

It("stable-v1 to alpha, currently version 1.22", func() {
if ocpVersion.GT(ocp412) {
Skip("This test runs only on OCP 4.12 or lower")
if ocpVersion.GT(ocp413) {
Skip(fmt.Sprintf("This test runs only on OCP 4.12 or lower, current ocp version is %s", ocpVersion.String()))
}
DeferCleanup(cleanupOpenshift)
applyUpgrade("stable-v1", "alpha")
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func CreateSubscription(env *TestingEnvironment, channel string) error {
"channel": channel,
"installPlanApproval": "Automatic",
"name": "cloudnative-pg",
"source": "cloudnative-pg-manifests",
"source": "cloudnative-pg-catalog",
"sourceNamespace": "openshift-marketplace",
}

Expand Down
Loading