Skip to content

Commit e4f8db5

Browse files
Merge pull request #558 from jianzhangbjz/OTE
OCPQE-30672: migrate jiazha test cases to OTE
2 parents 009fb19 + 63baa57 commit e4f8db5

File tree

4 files changed

+225
-0
lines changed

4 files changed

+225
-0
lines changed

openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
[
2+
{
3+
"name": "[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:80078-[OTP]Downstream feature gate promotion mechanics",
4+
"originalName": "[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:80078-Downstream feature gate promotion mechanics",
5+
"labels": {
6+
"Extended": {},
7+
"NonHyperShiftHOST": {},
8+
"original-name:[sig-olmv1][Jira:OLM] cluster-olm-operator PolarionID:80078-Downstream feature gate promotion mechanics": {}
9+
},
10+
"resources": {
11+
"isolation": {}
12+
},
13+
"source": "openshift:payload:olmv1",
14+
"lifecycle": "blocking",
15+
"environmentSelector": {
16+
"exclude": "topology==\"External\""
17+
}
18+
},
219
{
320
"name": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:69242-[OTP][Skipped:Disconnected]Catalogd deprecated package bundlemetadata catalogmetadata from clustercatalog CR",
421
"originalName": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:69242-[Skipped:Disconnected]Catalogd deprecated package bundlemetadata catalogmetadata from clustercatalog CR",
@@ -16,6 +33,23 @@
1633
"exclude": "topology==\"External\""
1734
}
1835
},
36+
{
37+
"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]",
38+
"originalName": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:80458-[Skipped:Disconnected]clustercatalog get x509 error since it cannot get the custom CA automatically [Serial]",
39+
"labels": {
40+
"Extended": {},
41+
"NonHyperShiftHOST": {},
42+
"original-name:[sig-olmv1][Jira:OLM] clustercatalog PolarionID:80458-[Skipped:Disconnected]clustercatalog get x509 error since it cannot get the custom CA automatically [Serial]": {}
43+
},
44+
"resources": {
45+
"isolation": {}
46+
},
47+
"source": "openshift:payload:olmv1",
48+
"lifecycle": "blocking",
49+
"environmentSelector": {
50+
"exclude": "topology==\"External\""
51+
}
52+
},
1953
{
2054
"name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:83069-[OTP]olmv1 static networkpolicy.",
2155
"originalName": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:83069-olmv1 static networkpolicy.",
@@ -272,6 +306,23 @@
272306
"exclude": "topology==\"External\""
273307
}
274308
},
309+
{
310+
"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",
311+
"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",
312+
"labels": {
313+
"Extended": {},
314+
"NonHyperShiftHOST": {},
315+
"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": {}
316+
},
317+
"resources": {
318+
"isolation": {}
319+
},
320+
"source": "openshift:payload:olmv1",
321+
"lifecycle": "blocking",
322+
"environmentSelector": {
323+
"exclude": "topology==\"External\""
324+
}
325+
},
275326
{
276327
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 Catalogs should be installed",
277328
"labels": {},
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package specs
2+
3+
import (
4+
"strings"
5+
6+
g "github.com/onsi/ginkgo/v2"
7+
o "github.com/onsi/gomega"
8+
e2e "k8s.io/kubernetes/test/e2e/framework"
9+
10+
exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util"
11+
)
12+
13+
var _ = g.Describe("[sig-olmv1][Jira:OLM] cluster-olm-operator", g.Label("NonHyperShiftHOST"), func() {
14+
defer g.GinkgoRecover()
15+
var (
16+
oc = exutil.NewCLIWithoutNamespace("default")
17+
)
18+
19+
g.BeforeEach(func() {
20+
exutil.SkipMicroshift(oc)
21+
exutil.SkipNoOLMv1Core(oc)
22+
})
23+
24+
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() {
25+
args, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("deploy", "catalogd-controller-manager", "-o=jsonpath={.spec.template.spec.containers[0].args}", "-n", "openshift-catalogd").Output()
26+
o.Expect(err).NotTo(o.HaveOccurred())
27+
if exutil.IsTechPreviewNoUpgrade(oc) {
28+
enabledFeatures, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("featuregate", "cluster", "-o=jsonpath={.status.featureGates[0].enabled}").Output()
29+
o.Expect(err).NotTo(o.HaveOccurred())
30+
if !strings.Contains(enabledFeatures, "NewOLMCatalogdAPIV1Metas") {
31+
e2e.Failf("the NewOLMCatalogdAPIV1Metas feature wasn't enabled in the TP cluster: %v", enabledFeatures)
32+
}
33+
if !strings.Contains(args, "APIV1MetasHandler=true") {
34+
e2e.Failf("the APIV1MetasHandler argument wasn't enabled in the TP cluster: %v", args)
35+
}
36+
} else {
37+
if strings.Contains(args, "APIV1MetasHandler=true") {
38+
e2e.Failf("the APIV1MetasHandler argument enabled in the general cluster: %v", args)
39+
}
40+
}
41+
})
42+
43+
})

openshift/tests-extension/test/qe/specs/olmv1_cc.go

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
package specs
22

33
import (
4+
"context"
5+
"fmt"
6+
"path/filepath"
47
"strings"
8+
"time"
59

610
g "github.com/onsi/ginkgo/v2"
711
o "github.com/onsi/gomega"
12+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
13+
"k8s.io/apimachinery/pkg/util/wait"
814
e2e "k8s.io/kubernetes/test/e2e/framework"
915

1016
exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util"
17+
olmv1util "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util/olmv1util"
1118
)
1219

1320
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
3441

3542
})
3643

44+
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() {
45+
g.By("1) create a random namespace")
46+
oc.SetupProject()
47+
g.By("2) create an image registry")
48+
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()
49+
o.Expect(err).NotTo(o.HaveOccurred())
50+
51+
registryPodsList, err := exutil.WaitForPods(
52+
oc.AdminKubeClient().CoreV1().Pods(oc.Namespace()),
53+
exutil.ParseLabelsOrDie("deployment=registry"),
54+
exutil.CheckPodIsReady, 1, 180000000000)
55+
o.Expect(err).NotTo(o.HaveOccurred())
56+
e2e.Logf("Get registry pods: %v", registryPodsList)
57+
58+
_, err = oc.WithoutNamespace().Run("create").Args("route", "edge", "my-route", "--service=registry", "-n", oc.Namespace()).Output()
59+
o.Expect(err).NotTo(o.HaveOccurred())
60+
hostName, err := oc.WithoutNamespace().Run("get").Args("route", "my-route", "-o=jsonpath={.spec.host}", "-n", oc.Namespace()).Output()
61+
o.Expect(err).NotTo(o.HaveOccurred())
62+
_, err = oc.WithoutNamespace().Run("set").Args("volume", "deploy", "registry", "--add", "-t", "pvc", "--claim-size=30G", "-m", "/var/lib/registry", "--overwrite", "-n", oc.Namespace()).Output()
63+
o.Expect(err).NotTo(o.HaveOccurred())
64+
_, err = oc.AsAdmin().WithoutNamespace().Run("extract").Args("secret/router-ca", "-n", "openshift-ingress-operator", "--to=/tmp", "--confirm").Output()
65+
o.Expect(err).NotTo(o.HaveOccurred())
66+
67+
defer func() {
68+
err = oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", "openshift-config", "configmap", "trusted-ca-80458").Execute()
69+
o.Expect(err).NotTo(o.HaveOccurred())
70+
}()
71+
_, err = oc.AsAdmin().WithoutNamespace().Run("create").Args("-n", "openshift-config", "configmap", "trusted-ca-80458", fmt.Sprintf("--from-file=%s=/tmp/tls.crt", hostName)).Output()
72+
o.Expect(err).NotTo(o.HaveOccurred())
73+
74+
defer func() {
75+
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 {
76+
e2e.Failf("unpatch image.config.openshift.io/cluster failed:%v", err)
77+
}
78+
}()
79+
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 {
80+
e2e.Failf("patch image.config.openshift.io/cluster failed:%v", err)
81+
}
82+
83+
g.By("2.1) Wait for CA bundle to propagate to catalogd")
84+
// Wait for cluster-network-operator to sync CA from trusted-ca-80458 to catalogd-trusted-ca-bundle
85+
// This happens automatically without pod restart
86+
configTime := time.Now()
87+
errWait := wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 3*time.Minute, false, func(ctx context.Context) (bool, error) {
88+
cm, err := oc.AdminKubeClient().CoreV1().ConfigMaps("openshift-catalogd").Get(ctx, "catalogd-trusted-ca-bundle", metav1.GetOptions{})
89+
if err != nil {
90+
e2e.Logf("Failed to get catalogd-trusted-ca-bundle ConfigMap: %v, retrying...", err)
91+
return false, nil
92+
}
93+
// Check if ConfigMap was updated after we configured additionalTrustedCA
94+
if cm.CreationTimestamp.After(configTime) {
95+
e2e.Logf("catalogd-trusted-ca-bundle ConfigMap was created at %v (after CA config)", cm.CreationTimestamp)
96+
return true, nil
97+
}
98+
// For existing ConfigMap, check if it has data (indicating it was updated)
99+
if len(cm.Data) > 0 {
100+
e2e.Logf("catalogd-trusted-ca-bundle ConfigMap has CA data, CA bundle synced")
101+
return true, nil
102+
}
103+
e2e.Logf("Waiting for catalogd-trusted-ca-bundle ConfigMap to be synced...")
104+
return false, nil
105+
})
106+
if errWait != nil {
107+
e2e.Failf("Timeout waiting for CA bundle to propagate to catalogd ConfigMap: %v", errWait)
108+
}
109+
110+
g.By("3) create a ClusterCatalog")
111+
var (
112+
baseDir = exutil.FixturePath("testdata", "olm")
113+
clustercatalogTemplate = filepath.Join(baseDir, "clustercatalog.yaml")
114+
115+
clustercatalog = olmv1util.ClusterCatalogDescription{
116+
Name: "clustercatalog-80458",
117+
Imageref: fmt.Sprintf("%s/redhat/redhat-operator-index:v4.17", hostName),
118+
Template: clustercatalogTemplate,
119+
}
120+
)
121+
defer clustercatalog.Delete(oc)
122+
_ = clustercatalog.CreateWithoutCheck(oc)
123+
// it should retrun error message: source catalog content: error creating image source:
124+
// reading manifest v4.17 in my-route-e2e-test-default-gt5wh.apps.xiyuan-19b.qe.devcluster.openshift.com/redhat/redhat-operator-index: manifest unknown
125+
clustercatalog.CheckClusterCatalogCondition(oc, "Progressing", "message", "manifest unknown", 5, 90, 0)
126+
})
127+
37128
})

openshift/tests-extension/test/qe/specs/olmv1_ce.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,4 +1453,44 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
14531453

14541454
})
14551455

1456+
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() {
1457+
baseDir := exutil.FixturePath("testdata", "olm")
1458+
clusterextensionTemplate := filepath.Join(baseDir, "clusterextension.yaml")
1459+
saAdminTemplate := filepath.Join(baseDir, "sa-admin.yaml")
1460+
g.By("1)install Argocd operator v0.4.0 in a random namespace")
1461+
sa := "argocd-83026"
1462+
oc.SetupProject()
1463+
1464+
saCrb := olmv1util.SaCLusterRolebindingDescription{
1465+
Name: sa,
1466+
Namespace: oc.Namespace(),
1467+
Template: saAdminTemplate,
1468+
}
1469+
defer saCrb.Delete(oc)
1470+
saCrb.Create(oc)
1471+
1472+
ceArgocd := olmv1util.ClusterExtensionDescription{
1473+
Name: "extension-argocd-83026",
1474+
PackageName: "argocd-operator",
1475+
Channel: "alpha",
1476+
Version: "v0.4.0",
1477+
InstallNamespace: oc.Namespace(),
1478+
SaName: sa,
1479+
Template: clusterextensionTemplate,
1480+
}
1481+
defer ceArgocd.Delete(oc)
1482+
ceArgocd.Create(oc)
1483+
1484+
g.By("2)upgrade it to v0.5.0")
1485+
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 {
1486+
e2e.Failf("patch clusterextension failed:%v", err)
1487+
}
1488+
ceArgocd.WaitProgressingMessage(oc, "Desired state reached")
1489+
g.By("3)upgrade it to v0.7.0")
1490+
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 {
1491+
e2e.Failf("patch clusterextension failed:%v", err)
1492+
}
1493+
ceArgocd.WaitProgressingMessage(oc, "Desired state reached")
1494+
})
1495+
14561496
})

0 commit comments

Comments
 (0)