Skip to content

Commit f00c46b

Browse files
UPSTREAM: <carry>: migrate OLMv0 test cases to OTE
2 parents c2c64b7 + 7c710ed commit f00c46b

File tree

2 files changed

+17
-136
lines changed

2 files changed

+17
-136
lines changed

tests-extension/.openshift-tests-extension/openshift_payload_olmv0.json

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -155,34 +155,28 @@
155155
"originalName": "[sig-operator][Jira:OLM] OLMv0 should PolarionID:29775-PolarionID:29786-[Skipped:Disconnected]as oc user on linux to mirror catalog image[Slow][Timeout:30m]",
156156
"labels": {
157157
"Extended": {},
158-
"NonHyperShiftHOST": {},
159158
"original-name:[sig-operator][Jira:OLM] OLMv0 should PolarionID:29775-PolarionID:29786-[Skipped:Disconnected]as oc user on linux to mirror catalog image[Slow][Timeout:30m]": {}
160159
},
161160
"resources": {
162161
"isolation": {}
163162
},
164163
"source": "openshift:payload:olmv0",
165164
"lifecycle": "blocking",
166-
"environmentSelector": {
167-
"exclude": "topology==\"External\""
168-
}
165+
"environmentSelector": {}
169166
},
170167
{
171168
"name": "[sig-operator][Jira:OLM] OLMv0 should PolarionID:33452-[OTP][Skipped:Disconnected]oc adm catalog mirror does not mirror the index image itself",
172169
"originalName": "[sig-operator][Jira:OLM] OLMv0 should PolarionID:33452-[Skipped:Disconnected]oc adm catalog mirror does not mirror the index image itself",
173170
"labels": {
174171
"Extended": {},
175-
"NonHyperShiftHOST": {},
176172
"original-name:[sig-operator][Jira:OLM] OLMv0 should PolarionID:33452-[Skipped:Disconnected]oc adm catalog mirror does not mirror the index image itself": {}
177173
},
178174
"resources": {
179175
"isolation": {}
180176
},
181177
"source": "openshift:payload:olmv0",
182178
"lifecycle": "blocking",
183-
"environmentSelector": {
184-
"exclude": "topology==\"External\""
185-
}
179+
"environmentSelector": {}
186180
},
187181
{
188182
"name": "[sig-operator][Jira:OLM] OLMv0 should PolarionID:21825-[OTP][Skipped:Disconnected]Certs for packageserver can be rotated successfully [Serial]",
@@ -351,21 +345,6 @@
351345
"exclude": "topology==\"External\""
352346
}
353347
},
354-
{
355-
"name": "[sig-operator][Jira:OLM] OLMv0 should PolarionID:43975-[OTP]olm operator serviceaccount should not rely on external networking for health check[Serial][Disruptive][Slow]",
356-
"labels": {
357-
"Extended": {},
358-
"NonHyperShiftHOST": {}
359-
},
360-
"resources": {
361-
"isolation": {}
362-
},
363-
"source": "openshift:payload:olmv0",
364-
"lifecycle": "blocking",
365-
"environmentSelector": {
366-
"exclude": "topology==\"External\""
367-
}
368-
},
369348
{
370349
"name": "[sig-operator][Jira:OLM] OLMv0 optional should PolarionID:68679-[OTP][Skipped:Disconnected]catalogsource with invalid name is created",
371350
"originalName": "[sig-operator][Jira:OLM] OLMv0 optional should PolarionID:68679-[Skipped:Disconnected]catalogsource with invalid name is created",

tests-extension/test/qe/specs/olmv0_common.go

Lines changed: 15 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"fmt"
66
"os/exec"
77
"path/filepath"
8-
"regexp"
9-
"strconv"
108
"strings"
119
"time"
1210

@@ -92,15 +90,15 @@ var _ = g.Describe("[sig-operator][Jira:OLM] OLMv0 should", func() {
9290
olmv0util.NewCheck("expect", exutil.AsAdmin, exutil.WithoutNamespace, exutil.Compare, olmVersion, exutil.Ok, []string{"clusteroperator", "-o=jsonpath={.items[?(@.metadata.name==\"" + olmClusterOperatorName + "\")].status.versions[?(@.name==\"operator\")].version}"}).Check(oc)
9391
})
9492

95-
g.It("PolarionID:29775-PolarionID:29786-[OTP][Skipped:Disconnected]as oc user on linux to mirror catalog image[Slow][Timeout:30m]", g.Label("original-name:[sig-operator][Jira:OLM] OLMv0 should PolarionID:29775-PolarionID:29786-[Skipped:Disconnected]as oc user on linux to mirror catalog image[Slow][Timeout:30m]"), g.Label("NonHyperShiftHOST"), func() {
93+
g.It("PolarionID:29775-PolarionID:29786-[OTP][Skipped:Disconnected]as oc user on linux to mirror catalog image[Slow][Timeout:30m]", g.Label("original-name:[sig-operator][Jira:OLM] OLMv0 should PolarionID:29775-PolarionID:29786-[Skipped:Disconnected]as oc user on linux to mirror catalog image[Slow][Timeout:30m]"), func() {
9694
var (
9795
bundleIndex1 = "quay.io/kuiwang/operators-all:v1"
9896
bundleIndex2 = "quay.io/kuiwang/operators-dockerio:v1"
99-
operatorAllPath = "/tmp/operators-all-manifests-" + exutil.GetRandomString()
100-
operatorDockerioPath = "/tmp/operators-dockerio-manifests-" + exutil.GetRandomString()
97+
operatorAllPath = "operators-all-manifests-" + exutil.GetRandomString()
98+
operatorDockerioPath = "operators-dockerio-manifests-" + exutil.GetRandomString()
10199
)
102-
defer func() { _, _ = exec.Command("bash", "-c", "rm -fr "+operatorAllPath).Output() }()
103-
defer func() { _, _ = exec.Command("bash", "-c", "rm -fr "+operatorDockerioPath).Output() }()
100+
defer func() { _, _ = exec.Command("bash", "-c", "rm -fr ./"+operatorAllPath).Output() }()
101+
defer func() { _, _ = exec.Command("bash", "-c", "rm -fr ./"+operatorDockerioPath).Output() }()
104102

105103
g.By("mirror to quay.io/kuiwang")
106104
var output string
@@ -125,14 +123,14 @@ var _ = g.Describe("[sig-operator][Jira:OLM] OLMv0 should", func() {
125123
o.Expect(output).To(o.ContainSubstring("operators-all-manifests"))
126124

127125
g.By("check mapping.txt")
128-
result, err := exec.Command("bash", "-c", "cat "+operatorAllPath+"/mapping.txt|grep -E \"atlasmap-atlasmap-operator:0.1.0|quay.io/kuiwang/jmckind-argocd-operator:[a-z0-9][a-z0-9]|redhat-cop-cert-utils-operator:latest\"").Output()
126+
result, err := exec.Command("bash", "-c", "cat ./"+operatorAllPath+"/mapping.txt|grep -E \"atlasmap-atlasmap-operator:0.1.0|quay.io/kuiwang/jmckind-argocd-operator:[a-z0-9][a-z0-9]|redhat-cop-cert-utils-operator:latest\"").Output()
129127
o.Expect(err).NotTo(o.HaveOccurred())
130128
o.Expect(result).To(o.ContainSubstring("atlasmap-atlasmap-operator:0.1.0"))
131129
o.Expect(result).To(o.ContainSubstring("redhat-cop-cert-utils-operator:latest"))
132130
o.Expect(result).To(o.ContainSubstring("quay.io/kuiwang/jmckind-argocd-operator"))
133131

134132
g.By("check icsp yaml")
135-
result, err = exec.Command("bash", "-c", "cat "+operatorAllPath+"/imageContentSourcePolicy.yaml | grep -E \"quay.io/kuiwang/strimzi-operator|docker.io/strimzi/operator$\"").Output()
133+
result, err = exec.Command("bash", "-c", "cat ./"+operatorAllPath+"/imageContentSourcePolicy.yaml | grep -E \"quay.io/kuiwang/strimzi-operator|docker.io/strimzi/operator$\"").Output()
136134
o.Expect(err).NotTo(o.HaveOccurred())
137135
o.Expect(result).To(o.ContainSubstring("- quay.io/kuiwang/strimzi-operator"))
138136
o.Expect(result).To(o.ContainSubstring("source: docker.io/strimzi/operator"))
@@ -158,38 +156,38 @@ var _ = g.Describe("[sig-operator][Jira:OLM] OLMv0 should", func() {
158156
o.Expect(output).To(o.ContainSubstring("operators-dockerio-manifests"))
159157

160158
g.By("check mapping.txt to localhost:5000")
161-
result, err = exec.Command("bash", "-c", "cat "+operatorDockerioPath+"/mapping.txt|grep -E \"localhost:5000/atlasmap/atlasmap-operator:0.1.0|localhost:5000/strimzi/operator:[a-z0-9][a-z0-9]\"").Output()
159+
result, err = exec.Command("bash", "-c", "cat ./"+operatorDockerioPath+"/mapping.txt|grep -E \"localhost:5000/atlasmap/atlasmap-operator:0.1.0|localhost:5000/strimzi/operator:[a-z0-9][a-z0-9]\"").Output()
162160
o.Expect(err).NotTo(o.HaveOccurred())
163161
o.Expect(result).To(o.ContainSubstring("localhost:5000/atlasmap/atlasmap-operator:0.1.0"))
164162
o.Expect(result).To(o.ContainSubstring("localhost:5000/strimzi/operator"))
165163

166164
g.By("check icsp yaml to localhost:5000")
167-
result, err = exec.Command("bash", "-c", "cat "+operatorDockerioPath+"/imageContentSourcePolicy.yaml | grep -E \"localhost:5000/strimzi/operator|docker.io/strimzi/operator$\"").Output()
165+
result, err = exec.Command("bash", "-c", "cat ./"+operatorDockerioPath+"/imageContentSourcePolicy.yaml | grep -E \"localhost:5000/strimzi/operator|docker.io/strimzi/operator$\"").Output()
168166
o.Expect(err).NotTo(o.HaveOccurred())
169167
o.Expect(result).To(o.ContainSubstring("- localhost:5000/strimzi/operator"))
170168
o.Expect(result).To(o.ContainSubstring("source: docker.io/strimzi/operator"))
171169
o.Expect(result).NotTo(o.ContainSubstring("docker.io/atlasmap/atlasmap-operator"))
172170
})
173171

174-
g.It("PolarionID:33452-[OTP][Skipped:Disconnected]oc adm catalog mirror does not mirror the index image itself", g.Label("original-name:[sig-operator][Jira:OLM] OLMv0 should PolarionID:33452-[Skipped:Disconnected]oc adm catalog mirror does not mirror the index image itself"), g.Label("NonHyperShiftHOST"), func() {
172+
g.It("PolarionID:33452-[OTP][Skipped:Disconnected]oc adm catalog mirror does not mirror the index image itself", g.Label("original-name:[sig-operator][Jira:OLM] OLMv0 should PolarionID:33452-[Skipped:Disconnected]oc adm catalog mirror does not mirror the index image itself"), func() {
175173
var (
176174
bundleIndex1 = "quay.io/olmqe/olm-api@sha256:71cfd4deaa493d31cd1d8255b1dce0fb670ae574f4839c778f2cfb1bf1f96995"
177-
manifestPath = "/tmp/manifests-olm-api-" + exutil.GetRandomString()
175+
manifestPath = "manifests-olm-api-" + exutil.GetRandomString()
178176
)
179-
defer func() { _, _ = exec.Command("bash", "-c", "rm -fr "+manifestPath).Output() }()
177+
defer func() { _, _ = exec.Command("bash", "-c", "rm -fr ./"+manifestPath).Output() }()
180178

181179
g.By("mirror to localhost:5000/test")
182180
output, err := oc.AsAdmin().WithoutNamespace().Run("adm", "catalog", "mirror").Args("--manifests-only", "--to-manifests="+manifestPath, bundleIndex1, "localhost:5000/test").Output()
183181
o.Expect(err).NotTo(o.HaveOccurred())
184182
o.Expect(output).To(o.ContainSubstring("manifests-olm-api"))
185183

186184
g.By("check mapping.txt to localhost:5000")
187-
result, err := exec.Command("bash", "-c", "cat "+manifestPath+"/mapping.txt|grep -E \"quay.io/olmqe/olm-api\"").Output()
185+
result, err := exec.Command("bash", "-c", "cat ./"+manifestPath+"/mapping.txt|grep -E \"quay.io/olmqe/olm-api\"").Output()
188186
o.Expect(err).NotTo(o.HaveOccurred())
189187
o.Expect(result).To(o.ContainSubstring("quay.io/olmqe/olm-api"))
190188

191189
g.By("check icsp yaml to localhost:5000")
192-
result, err = exec.Command("bash", "-c", "cat "+manifestPath+"/imageContentSourcePolicy.yaml | grep -E \"quay.io/olmqe/olm-api\"").Output()
190+
result, err = exec.Command("bash", "-c", "cat ./"+manifestPath+"/imageContentSourcePolicy.yaml | grep -E \"quay.io/olmqe/olm-api\"").Output()
193191
o.Expect(err).NotTo(o.HaveOccurred())
194192
o.Expect(result).To(o.ContainSubstring("quay.io/olmqe/olm-api"))
195193
})
@@ -877,6 +875,7 @@ var _ = g.Describe("[sig-operator][Jira:OLM] OLMv0 should", func() {
877875
}
878876
}
879877
})
878+
880879
g.It("PolarionID:24075-[OTP][Skipped:Disconnected]The packagemanifest labels provider value should be correct", g.Label("NonHyperShiftHOST"), func() {
881880
exutil.SkipIfDisableDefaultCatalogsource(oc)
882881

@@ -1047,101 +1046,4 @@ var _ = g.Describe("[sig-operator][Jira:OLM] OLMv0 should", func() {
10471046
e2e.Logf("PrometheusRule validation passed: Alert rule is properly configured to monitor catalogsource_ready metric")
10481047
})
10491048

1050-
g.It("PolarionID:43975-[OTP]olm operator serviceaccount should not rely on external networking for health check[Disruptive][Slow]", g.Label("NonHyperShiftHOST"), func() {
1051-
g.By("1) get the cluster infrastructure")
1052-
infra, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("infrastructures", "cluster", "-o=jsonpath={.status.infrastructureTopology}").Output()
1053-
if err != nil {
1054-
e2e.Failf("Fail to get the cluster infra")
1055-
}
1056-
if infra != "SingleReplica" {
1057-
g.Skip("Not SNO cluster - skipping test ...")
1058-
}
1059-
1060-
originProfile := olmv0util.GetResource(oc, exutil.AsAdmin, exutil.WithoutNamespace, "apiserver", "cluster", "-o=jsonpath={.spec.audit.profile}")
1061-
o.Expect(originProfile).NotTo(o.BeEmpty())
1062-
if strings.Compare(originProfile, "Default") != 0 {
1063-
g.Skip("audit profile is not Default - skipping test ...")
1064-
}
1065-
1066-
g.By("2) get revision number")
1067-
revisionNumber1 := 0
1068-
reg := regexp.MustCompile(`at revision (\d+)`)
1069-
if reg == nil {
1070-
e2e.Failf("get revision number regexp err!")
1071-
}
1072-
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("kubeapiserver", "-o=jsonpath={..status.conditions[?(@.type==\"NodeInstallerProgressing\")]}").Output()
1073-
if err != nil {
1074-
e2e.Failf("Fail to get kubeapiserver")
1075-
}
1076-
result := reg.FindAllStringSubmatch(output, -1)
1077-
if result != nil {
1078-
revisionNumberStr1 := result[0][1]
1079-
revisionNumber1, _ = strconv.Atoi(revisionNumberStr1)
1080-
e2e.Logf("origin revision number is : %v", revisionNumber1)
1081-
} else {
1082-
e2e.Failf("Fail to get revision number")
1083-
}
1084-
1085-
g.By("3) Configuring the audit log policy to AllRequestBodies")
1086-
defer func() {
1087-
pathJSON := fmt.Sprintf("{\"spec\":{\"audit\":{\"profile\":\"%s\"}}}", originProfile)
1088-
e2e.Logf("recover to be %v", pathJSON)
1089-
exutil.PatchResource(oc, exutil.AsAdmin, exutil.WithoutNamespace, "apiserver", "cluster", "-p", pathJSON, "--type=merge")
1090-
output = olmv0util.GetResource(oc, exutil.AsAdmin, exutil.WithoutNamespace, "apiserver", "cluster", "-o=jsonpath={.spec.audit.profile}")
1091-
o.Expect(output).To(o.Equal("Default"))
1092-
}()
1093-
exutil.PatchResource(oc, exutil.AsAdmin, exutil.WithoutNamespace, "apiserver", "cluster", "-p", "{\"spec\":{\"audit\":{\"profile\":\"AllRequestBodies\"}}}", "--type=merge")
1094-
output = olmv0util.GetResource(oc, exutil.AsAdmin, exutil.WithoutNamespace, "apiserver", "cluster", "-o=jsonpath={.spec.audit.profile}")
1095-
o.Expect(output).To(o.Equal("AllRequestBodies"))
1096-
1097-
g.By("4) Wait for api rollout")
1098-
err = wait.PollUntilContextTimeout(context.TODO(), 30*time.Second, 600*time.Second, false, func(ctx context.Context) (bool, error) {
1099-
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("kubeapiserver", "-o=jsonpath={..status.conditions[?(@.type==\"NodeInstallerProgressing\")]}").Output()
1100-
e2e.Logf("kubeapiserver status output: %s", output)
1101-
if err != nil {
1102-
e2e.Logf("Fail to get kubeapiserver status, go next round")
1103-
return false, nil
1104-
}
1105-
if !strings.Contains(output, "AllNodesAtLatestRevision") {
1106-
e2e.Logf("the api is rolling, go next round")
1107-
return false, nil
1108-
}
1109-
result := reg.FindAllStringSubmatch(output, -1)
1110-
if result != nil {
1111-
revisionNumberStr2 := result[0][1]
1112-
revisionNumber2, _ := strconv.Atoi(revisionNumberStr2)
1113-
e2e.Logf("revision number is : %v", revisionNumber2)
1114-
if revisionNumber2 > revisionNumber1 {
1115-
return true, nil
1116-
}
1117-
e2e.Logf("revision number is not changed, go next round")
1118-
return false, nil
1119-
1120-
}
1121-
e2e.Logf("Fail to get revision number, go next round")
1122-
return false, nil
1123-
})
1124-
exutil.AssertWaitPollNoErr(err, "api not rollout")
1125-
1126-
// According to the case steps, wait for 5 minutes, then check the audit log doesn't contain olm-operator-serviceaccount.
1127-
g.By("Wait for 5 minutes, then check the audit log")
1128-
time.Sleep(5 * time.Minute)
1129-
1130-
g.By("check the audit log")
1131-
nodeName, err := exutil.GetFirstMasterNode(oc)
1132-
e2e.Logf("master node name: %s", nodeName)
1133-
o.Expect(err).NotTo(o.HaveOccurred())
1134-
auditlogPath := "43975.log"
1135-
defer func() {
1136-
_, _ = exec.Command("bash", "-c", "rm -fr "+auditlogPath).Output()
1137-
}()
1138-
outputPath, err := oc.AsAdmin().WithoutNamespace().Run("adm").Args("node-logs", nodeName, "--path=kube-apiserver/audit.log").OutputToFile(auditlogPath)
1139-
o.Expect(err).NotTo(o.HaveOccurred())
1140-
commandParserLog := "cat " + outputPath + " | grep -i health | grep -i subjectaccessreviews | grep -v Unhealth | jq -r '.user.username' | sort | uniq"
1141-
resultParserLog, err := exec.Command("bash", "-c", commandParserLog).Output()
1142-
o.Expect(err).NotTo(o.HaveOccurred())
1143-
e2e.Logf("Found usernames in audit log: %s", string(resultParserLog))
1144-
o.Expect(resultParserLog).NotTo(o.ContainSubstring("olm-operator-serviceaccount"))
1145-
})
1146-
11471049
})

0 commit comments

Comments
 (0)