From 1528600da338c854d278cf7636da097f92e1a906 Mon Sep 17 00:00:00 2001 From: Tao Li Date: Tue, 6 Feb 2024 13:47:42 +0800 Subject: [PATCH 1/5] test: enable openshift ugprade test Signed-off-by: Tao Li --- tests/e2e/openshift_upgrade_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/openshift_upgrade_test.go b/tests/e2e/openshift_upgrade_test.go index 0445e0b602..d6f414f20d 100644 --- a/tests/e2e/openshift_upgrade_test.go +++ b/tests/e2e/openshift_upgrade_test.go @@ -39,7 +39,6 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere var err error BeforeAll(func() { - Skip("Disable until a new fix is compatible") }) BeforeEach(func() { From 6ec0796b5ef5b1959b4ed645bf16059635be4afa Mon Sep 17 00:00:00 2001 From: Tao Li Date: Tue, 6 Feb 2024 14:59:09 +0800 Subject: [PATCH 2/5] test: display version when skip Signed-off-by: Tao Li --- tests/e2e/openshift_upgrade_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e/openshift_upgrade_test.go b/tests/e2e/openshift_upgrade_test.go index d6f414f20d..d6346f0758 100644 --- a/tests/e2e/openshift_upgrade_test.go +++ b/tests/e2e/openshift_upgrade_test.go @@ -16,6 +16,7 @@ limitations under the License. package e2e import ( + "fmt" "github.com/blang/semver" "github.com/cloudnative-pg/cloudnative-pg/tests" @@ -165,7 +166,8 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere 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") + Skip(fmt.Sprintf("This test runs only on OCP 4.12 or lower, current version is %s", + ocpVersion.String())) } DeferCleanup(cleanupOpenshift) applyUpgrade("stable-v1", "alpha") From a0f342ae6f7afef7e30fc32cab1c9b48f4d2fe6a Mon Sep 17 00:00:00 2001 From: Tao Li Date: Tue, 6 Feb 2024 15:46:13 +0800 Subject: [PATCH 3/5] test: upgrade test run on ocp4.12 Signed-off-by: Tao Li --- tests/e2e/openshift_upgrade_test.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/e2e/openshift_upgrade_test.go b/tests/e2e/openshift_upgrade_test.go index d6346f0758..cb1952fbf7 100644 --- a/tests/e2e/openshift_upgrade_test.go +++ b/tests/e2e/openshift_upgrade_test.go @@ -18,7 +18,6 @@ package e2e import ( "fmt" "github.com/blang/semver" - "github.com/cloudnative-pg/cloudnative-pg/tests" testsUtils "github.com/cloudnative-pg/cloudnative-pg/tests/utils" @@ -35,7 +34,7 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere sampleFile = fixturesDir + "/base/cluster-storage-class.yaml.template" ) - var ocp412 semver.Version + var ocp413 semver.Version var ocpVersion semver.Version var err error @@ -50,7 +49,7 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere 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) @@ -122,8 +121,11 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere // 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() }) @@ -164,10 +166,9 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere assertClusterIsAligned(namespace, clusterName) } - It("stable-v1 to alpha, currently version 1.22", func() { - if ocpVersion.GT(ocp412) { - Skip(fmt.Sprintf("This test runs only on OCP 4.12 or lower, current version is %s", - ocpVersion.String())) + It(fmt.Sprintf("stable-v1 to alpha, currently version 1.22, ocp version %s", ocpVersion.String()), func() { + if ocpVersion.GT(ocp413) { + Skip("This test runs only on OCP 4.12 or lower") } DeferCleanup(cleanupOpenshift) applyUpgrade("stable-v1", "alpha") From 85b548c7859b3583bbe7e85670c6fc5b8abaf7fc Mon Sep 17 00:00:00 2001 From: Tao Li Date: Mon, 19 Feb 2024 10:47:38 +0800 Subject: [PATCH 4/5] correct dev catalog name Signed-off-by: Tao Li --- tests/e2e/openshift_upgrade_test.go | 5 +++-- tests/utils/openshift.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/e2e/openshift_upgrade_test.go b/tests/e2e/openshift_upgrade_test.go index cb1952fbf7..3aca461b78 100644 --- a/tests/e2e/openshift_upgrade_test.go +++ b/tests/e2e/openshift_upgrade_test.go @@ -17,6 +17,7 @@ package e2e import ( "fmt" + "github.com/blang/semver" "github.com/cloudnative-pg/cloudnative-pg/tests" testsUtils "github.com/cloudnative-pg/cloudnative-pg/tests/utils" @@ -166,9 +167,9 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere assertClusterIsAligned(namespace, clusterName) } - It(fmt.Sprintf("stable-v1 to alpha, currently version 1.22, ocp version %s", ocpVersion.String()), func() { + It("stable-v1 to alpha, currently version 1.22", func() { if ocpVersion.GT(ocp413) { - Skip("This test runs only on OCP 4.12 or lower") + 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") diff --git a/tests/utils/openshift.go b/tests/utils/openshift.go index 16395fc3ce..1e65b79191 100644 --- a/tests/utils/openshift.go +++ b/tests/utils/openshift.go @@ -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", } From 2b3622aa528f1d5e602ecc26621e6e593c6f0f15 Mon Sep 17 00:00:00 2001 From: Tao Li Date: Mon, 19 Feb 2024 14:08:12 +0800 Subject: [PATCH 5/5] hack, force run 4.12 Signed-off-by: Tao Li --- tests/e2e/openshift_upgrade_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/e2e/openshift_upgrade_test.go b/tests/e2e/openshift_upgrade_test.go index 3aca461b78..8896ac0558 100644 --- a/tests/e2e/openshift_upgrade_test.go +++ b/tests/e2e/openshift_upgrade_test.go @@ -130,10 +130,14 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere AssertOperatorIsReady() }) + subScription, err := testsUtils.GetSubscription(env) + 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()) @@ -155,6 +159,8 @@ var _ = Describe("Upgrade Paths on OpenShift", Label(tests.LabelUpgrade), Ordere // 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).