From fefc57078feebd46a8a81ea92944b3ad9114f7f8 Mon Sep 17 00:00:00 2001 From: Jian Zhang Date: Fri, 14 Nov 2025 14:00:06 +0800 Subject: [PATCH] UPSTREAM: : migrate jiazha test cases to OTE --- .../openshift_payload_olmv1.json | 51 +++++++++++ .../tests-extension/test/qe/specs/olmv1.go | 43 +++++++++ .../tests-extension/test/qe/specs/olmv1_cc.go | 91 +++++++++++++++++++ .../tests-extension/test/qe/specs/olmv1_ce.go | 40 ++++++++ 4 files changed, 225 insertions(+) create mode 100644 openshift/tests-extension/test/qe/specs/olmv1.go diff --git a/openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json b/openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json index b2e4e70d5..20b27a7e1 100644 --- a/openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json +++ b/openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json @@ -1,4 +1,21 @@ [ + { + "name": "[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:80078-[OTP]Downstream feature gate promotion mechanics", + "originalName": "[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:80078-Downstream feature gate promotion mechanics", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {}, + "original-name:[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:80078-Downstream feature gate promotion mechanics": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, { "name": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:69242-[OTP][Skipped:Disconnected]Catalogd deprecated package bundlemetadata catalogmetadata from clustercatalog CR", "originalName": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:69242-[Skipped:Disconnected]Catalogd deprecated package bundlemetadata catalogmetadata from clustercatalog CR", @@ -16,6 +33,23 @@ "exclude": "topology==\"External\"" } }, + { + "name": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:80458-[OTP][Level0][Skipped:Disconnected]clustercatalog get x509 error since it cannot get the custom CA automatically [Serial]", + "originalName": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:80458-[Skipped:Disconnected]clustercatalog get x509 error since it cannot get the custom CA automatically [Serial]", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {}, + "original-name:[sig-olmv1][Jira:OLM] clustercatalog PolarionID:80458-[Skipped:Disconnected]clustercatalog get x509 error since it cannot get the custom CA automatically [Serial]": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, { "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:83069-[OTP]olmv1 static networkpolicy.", "originalName": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:83069-olmv1 static networkpolicy.", @@ -272,6 +306,23 @@ "exclude": "topology==\"External\"" } }, + { + "name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:83026-[OTP][Skipped:Disconnected]clusterextension updates sometimes failed with the following error from the CRDUpgradeCheck resource unknown change and refusing to determine that change is safe", + "originalName": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:83026-[Skipped:Disconnected]clusterextension updates sometimes failed with the following error from the CRDUpgradeCheck resource unknown change and refusing to determine that change is safe", + "labels": { + "Extended": {}, + "NonHyperShiftHOST": {}, + "original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:83026-[Skipped:Disconnected]clusterextension updates sometimes failed with the following error from the CRDUpgradeCheck resource unknown change and refusing to determine that change is safe": {} + }, + "resources": { + "isolation": {} + }, + "source": "openshift:payload:olmv1", + "lifecycle": "blocking", + "environmentSelector": { + "exclude": "topology==\"External\"" + } + }, { "name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 Catalogs should be installed", "labels": {}, diff --git a/openshift/tests-extension/test/qe/specs/olmv1.go b/openshift/tests-extension/test/qe/specs/olmv1.go new file mode 100644 index 000000000..a53f1cb97 --- /dev/null +++ b/openshift/tests-extension/test/qe/specs/olmv1.go @@ -0,0 +1,43 @@ +package specs + +import ( + "strings" + + g "github.com/onsi/ginkgo/v2" + o "github.com/onsi/gomega" + e2e "k8s.io/kubernetes/test/e2e/framework" + + exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util" +) + +var _ = g.Describe("[sig-olmv1][Jira:OLM] cluster-olm-operator", g.Label("NonHyperShiftHOST"), func() { + defer g.GinkgoRecover() + var ( + oc = exutil.NewCLIWithoutNamespace("default") + ) + + g.BeforeEach(func() { + exutil.SkipMicroshift(oc) + exutil.SkipNoOLMv1Core(oc) + }) + + g.It("PolarionID:80078-[OTP]Downstream feature gate promotion mechanics", g.Label("original-name:[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:80078-Downstream feature gate promotion mechanics"), func() { + args, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("deploy", "catalogd-controller-manager", "-o=jsonpath={.spec.template.spec.containers[0].args}", "-n", "openshift-catalogd").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + if exutil.IsTechPreviewNoUpgrade(oc) { + enabledFeatures, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("featuregate", "cluster", "-o=jsonpath={.status.featureGates[0].enabled}").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + if !strings.Contains(enabledFeatures, "NewOLMCatalogdAPIV1Metas") { + e2e.Failf("the NewOLMCatalogdAPIV1Metas feature wasn't enabled in the TP cluster: %v", enabledFeatures) + } + if !strings.Contains(args, "APIV1MetasHandler=true") { + e2e.Failf("the APIV1MetasHandler argument wasn't enabled in the TP cluster: %v", args) + } + } else { + if strings.Contains(args, "APIV1MetasHandler=true") { + e2e.Failf("the APIV1MetasHandler argument enabled in the general cluster: %v", args) + } + } + }) + +}) diff --git a/openshift/tests-extension/test/qe/specs/olmv1_cc.go b/openshift/tests-extension/test/qe/specs/olmv1_cc.go index 07845ff24..c54e7d9a3 100644 --- a/openshift/tests-extension/test/qe/specs/olmv1_cc.go +++ b/openshift/tests-extension/test/qe/specs/olmv1_cc.go @@ -1,13 +1,20 @@ package specs import ( + "context" + "fmt" + "path/filepath" "strings" + "time" g "github.com/onsi/ginkgo/v2" o "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" e2e "k8s.io/kubernetes/test/e2e/framework" exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util" + olmv1util "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util/olmv1util" ) var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShiftHOST"), func() { @@ -34,4 +41,88 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clustercatalog", g.Label("NonHyperShif }) + g.It("PolarionID:80458-[OTP][Level0][Skipped:Disconnected]clustercatalog get x509 error since it cannot get the custom CA automatically [Serial]", g.Label("original-name:[sig-olmv1][Jira:OLM] clustercatalog PolarionID:80458-[Skipped:Disconnected]clustercatalog get x509 error since it cannot get the custom CA automatically [Serial]"), func() { + g.By("1) create a random namespace") + oc.SetupProject() + g.By("2) create an image registry") + err := oc.WithoutNamespace().Run("new-app").Args("--image", "quay.io/openshifttest/registry@sha256:1106aedc1b2e386520bc2fb797d9a7af47d651db31d8e7ab472f2352da37d1b3", "-n", oc.Namespace(), "REGISTRY_STORAGE_DELETE_ENABLED=true", "--import-mode=PreserveOriginal").Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + + registryPodsList, err := exutil.WaitForPods( + oc.AdminKubeClient().CoreV1().Pods(oc.Namespace()), + exutil.ParseLabelsOrDie("deployment=registry"), + exutil.CheckPodIsReady, 1, 180000000000) + o.Expect(err).NotTo(o.HaveOccurred()) + e2e.Logf("Get registry pods: %v", registryPodsList) + + _, err = oc.WithoutNamespace().Run("create").Args("route", "edge", "my-route", "--service=registry", "-n", oc.Namespace()).Output() + o.Expect(err).NotTo(o.HaveOccurred()) + hostName, err := oc.WithoutNamespace().Run("get").Args("route", "my-route", "-o=jsonpath={.spec.host}", "-n", oc.Namespace()).Output() + o.Expect(err).NotTo(o.HaveOccurred()) + _, err = oc.WithoutNamespace().Run("set").Args("volume", "deploy", "registry", "--add", "-t", "pvc", "--claim-size=30G", "-m", "/var/lib/registry", "--overwrite", "-n", oc.Namespace()).Output() + o.Expect(err).NotTo(o.HaveOccurred()) + _, err = oc.AsAdmin().WithoutNamespace().Run("extract").Args("secret/router-ca", "-n", "openshift-ingress-operator", "--to=/tmp", "--confirm").Output() + o.Expect(err).NotTo(o.HaveOccurred()) + + defer func() { + err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", "openshift-config", "configmap", "trusted-ca-80458").Execute() + o.Expect(err).NotTo(o.HaveOccurred()) + }() + _, err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-n", "openshift-config", "configmap", "trusted-ca-80458", fmt.Sprintf("--from-file=%s=/tmp/tls.crt", hostName)).Output() + o.Expect(err).NotTo(o.HaveOccurred()) + + defer func() { + if err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("image.config.openshift.io/cluster", "-p", fmt.Sprintf("{\"spec\": {\"additionalTrustedCA\": {\"name\": \"%s\"}}}", ""), "--type=merge").Execute(); err != nil { + e2e.Failf("unpatch image.config.openshift.io/cluster failed:%v", err) + } + }() + if err = oc.AsAdmin().WithoutNamespace().Run("patch").Args("image.config.openshift.io/cluster", "-p", fmt.Sprintf("{\"spec\": {\"additionalTrustedCA\": {\"name\": \"%s\"}}}", "trusted-ca-80458"), "--type=merge").Execute(); err != nil { + e2e.Failf("patch image.config.openshift.io/cluster failed:%v", err) + } + + g.By("2.1) Wait for CA bundle to propagate to catalogd") + // Wait for cluster-network-operator to sync CA from trusted-ca-80458 to catalogd-trusted-ca-bundle + // This happens automatically without pod restart + configTime := time.Now() + errWait := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 3*time.Minute, false, func(ctx context.Context) (bool, error) { + cm, err := oc.AdminKubeClient().CoreV1().ConfigMaps("openshift-catalogd").Get(ctx, "catalogd-trusted-ca-bundle", metav1.GetOptions{}) + if err != nil { + e2e.Logf("Failed to get catalogd-trusted-ca-bundle ConfigMap: %v, retrying...", err) + return false, nil + } + // Check if ConfigMap was updated after we configured additionalTrustedCA + if cm.CreationTimestamp.After(configTime) { + e2e.Logf("catalogd-trusted-ca-bundle ConfigMap was created at %v (after CA config)", cm.CreationTimestamp) + return true, nil + } + // For existing ConfigMap, check if it has data (indicating it was updated) + if len(cm.Data) > 0 { + e2e.Logf("catalogd-trusted-ca-bundle ConfigMap has CA data, CA bundle synced") + return true, nil + } + e2e.Logf("Waiting for catalogd-trusted-ca-bundle ConfigMap to be synced...") + return false, nil + }) + if errWait != nil { + e2e.Failf("Timeout waiting for CA bundle to propagate to catalogd ConfigMap: %v", errWait) + } + + g.By("3) create a ClusterCatalog") + var ( + baseDir = exutil.FixturePath("testdata", "olm") + clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml") + + clustercatalog = olmv1util.ClusterCatalogDescription{ + Name: "clustercatalog-80458", + Imageref: fmt.Sprintf("%s/redhat/redhat-operator-index:v4.17", hostName), + Template: clustercatalogTemplate, + } + ) + defer clustercatalog.Delete(oc) + _ = clustercatalog.CreateWithoutCheck(oc) + // it should retrun error message: source catalog content: error creating image source: + // reading manifest v4.17 in my-route-e2e-test-default-gt5wh.apps.xiyuan-19b.qe.devcluster.openshift.com/redhat/redhat-operator-index: manifest unknown + clustercatalog.CheckClusterCatalogCondition(oc, "Progressing", "message", "manifest unknown", 5, 90, 0) + }) + }) diff --git a/openshift/tests-extension/test/qe/specs/olmv1_ce.go b/openshift/tests-extension/test/qe/specs/olmv1_ce.go index b8de8cf3c..a6d840272 100644 --- a/openshift/tests-extension/test/qe/specs/olmv1_ce.go +++ b/openshift/tests-extension/test/qe/specs/olmv1_ce.go @@ -1445,4 +1445,44 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh }) + g.It("PolarionID:83026-[OTP][Skipped:Disconnected]clusterextension updates sometimes failed with the following error from the CRDUpgradeCheck resource unknown change and refusing to determine that change is safe", g.Label("original-name:[sig-olmv1][Jira:OLM] clusterextension PolarionID:83026-[Skipped:Disconnected]clusterextension updates sometimes failed with the following error from the CRDUpgradeCheck resource unknown change and refusing to determine that change is safe"), func() { + baseDir := exutil.FixturePath("testdata", "olm") + clusterextensionTemplate := filepath.Join(baseDir, "clusterextension.yaml") + saAdminTemplate := filepath.Join(baseDir, "sa-admin.yaml") + g.By("1)install Argocd operator v0.4.0 in a random namespace") + sa := "argocd-83026" + oc.SetupProject() + + saCrb := olmv1util.SaCLusterRolebindingDescription{ + Name: sa, + Namespace: oc.Namespace(), + Template: saAdminTemplate, + } + defer saCrb.Delete(oc) + saCrb.Create(oc) + + ceArgocd := olmv1util.ClusterExtensionDescription{ + Name: "extension-argocd-83026", + PackageName: "argocd-operator", + Channel: "alpha", + Version: "v0.4.0", + InstallNamespace: oc.Namespace(), + SaName: sa, + Template: clusterextensionTemplate, + } + defer ceArgocd.Delete(oc) + ceArgocd.Create(oc) + + g.By("2)upgrade it to v0.5.0") + if err := oc.AsAdmin().WithoutNamespace().Run("patch").Args("clusterextension", "extension-argocd-83026", "-p", "{\"spec\": {\"source\": {\"catalog\": {\"version\": \"v0.5.0\"}}}}", "--type=merge").Execute(); err != nil { + e2e.Failf("patch clusterextension failed:%v", err) + } + ceArgocd.WaitProgressingMessage(oc, "desired state reached") + g.By("3)upgrade it to v0.7.0") + if err := oc.AsAdmin().WithoutNamespace().Run("patch").Args("clusterextension", "extension-argocd-83026", "-p", "{\"spec\": {\"source\": {\"catalog\": {\"version\": \"v0.7.0\"}}}}", "--type=merge").Execute(); err != nil { + e2e.Failf("patch clusterextension failed:%v", err) + } + ceArgocd.WaitProgressingMessage(oc, "desired state reached") + }) + })