Skip to content

Commit ea34b70

Browse files
Merge pull request #467 from kuiwang02/migrateqecase
OCPQE-29416:Init OLMv1 OTE Framework for tests-private to migrate first case
2 parents 8854919 + 41bcf5b commit ea34b70

File tree

4,885 files changed

+844720
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,885 files changed

+844720
-51
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
11
[
2+
{
3+
"name": "[sig-olmv1][Jira:OLM] clustercatalog PolarionID:69242-[Skipped:Disconnected]Catalogd deprecated package/bundlemetadata/catalogmetadata from clustercatalog CR",
4+
"labels": {
5+
"Extended": {},
6+
"NonHyperShiftHOST": {}
7+
},
8+
"resources": {
9+
"isolation": {}
10+
},
11+
"source": "openshift:payload:olmv1",
12+
"lifecycle": "informing",
13+
"environmentSelector": {
14+
"exclude": "topology==\"External\""
15+
}
16+
},
17+
{
18+
"name": "[sig-olmv1][Jira:OLM] clusterextension PolarionID:83069-olmv1 static networkpolicy.",
19+
"labels": {
20+
"Extended": {},
21+
"NonHyperShiftHOST": {}
22+
},
23+
"resources": {
24+
"isolation": {}
25+
},
26+
"source": "openshift:payload:olmv1",
27+
"lifecycle": "informing",
28+
"environmentSelector": {
29+
"exclude": "topology==\"External\""
30+
}
31+
},
232
{
333
"name": "[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 Catalogs should be installed",
434
"labels": {},

openshift/tests-extension/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ pkg/bindata/catalog/catalog.go: $(shell find testdata/catalog -type f)
8080
$(GO_BINDATA) -pkg catalog -o $@ -prefix "testdata/catalog" testdata/catalog/...
8181
go fmt ./$(@D)/...
8282

83+
bindata: pkg/bindata/qe/bindata.go
84+
pkg/bindata/qe/bindata.go: $(shell find test/qe/testdata -type f)
85+
mkdir -p $(@D)
86+
$(GO_BINDATA) -nocompress -nometadata \
87+
-pkg testdata -o $@ -prefix "testextended" test/qe/testdata/...
88+
gofmt -s -w $@
89+
8390
# GO_COMPLIANCE_POLICY="exempt_all" must only be used for test related binaries.
8491
# It prevents various FIPS compliance policies from being applied to this compilation.
8592
# Do not set globally.

openshift/tests-extension/cmd/main.go

Lines changed: 104 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import (
1919
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
2020
"github.com/spf13/cobra"
2121

22-
"github/operator-framework-operator-controller/openshift/tests-extension/pkg/env"
23-
_ "github/operator-framework-operator-controller/openshift/tests-extension/test"
22+
"github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/pkg/env"
23+
_ "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test"
24+
_ "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/specs"
25+
exutil "github.com/openshift/operator-framework-operator-controller/openshift/tests-extension/test/qe/util"
2426
)
2527

2628
func main() {
@@ -48,50 +50,146 @@ func main() {
4850
// Contains fast, parallel-safe test cases only.
4951
// Excludes any tests labeled [Serial] or [Slow].
5052
// Note: Tests with [Serial] and [Slow] cannot run with openshift/conformance/parallel.
53+
// Note: It includes the extended cases which match the openshift-tests.
5154
ext.AddSuite(e.Suite{
5255
Name: "olmv1/parallel",
5356
Parents: []string{"openshift/conformance/parallel"},
5457
Qualifiers: []string{
55-
`!(name.contains("[Serial]") || name.contains("[Slow]"))`,
58+
`((!labels.exists(l, l=="Extended")) || (labels.exists(l, l=="Extended") && labels.exists(l, l=="ReleaseGate"))) &&
59+
!(name.contains("[Serial]") || name.contains("[Slow]"))`,
5660
},
5761
})
5862

5963
// Suite: olmv1/serial
6064
// ---------------------------------------------------------------
6165
// Contains tests explicitly labeled [Serial].
6266
// These tests are typically disruptive and must run one at a time.
67+
// Note: It includes the extended cases which match the openshift-tests.
6368
ext.AddSuite(e.Suite{
6469
Name: "olmv1/serial",
6570
Parents: []string{"openshift/conformance/serial"},
6671
Qualifiers: []string{
67-
`name.contains("[Serial]")`,
72+
`((!labels.exists(l, l=="Extended")) || (labels.exists(l, l=="Extended") && labels.exists(l, l=="ReleaseGate"))) &&
73+
(name.contains("[Serial]") && !name.contains("[Disruptive]") && !name.contains("[Slow]"))`,
74+
// refer to https://github.com/openshift/origin/blob/main/pkg/testsuites/standard_suites.go#L456
6875
},
6976
})
7077

7178
// Suite: olmv1/slow
7279
// // ---------------------------------------------------------------
7380
// Contains tests labeled [Slow], which take significant time to run.
7481
// These are not allowed in fast/parallel suites, and should run in optional/slow jobs.
82+
// Note: It includes the extended cases which match the openshift-tests.
7583
ext.AddSuite(e.Suite{
7684
Name: "olmv1/slow",
7785
Parents: []string{"openshift/optional/slow"},
7886
Qualifiers: []string{
79-
`name.contains("[Slow]")`,
87+
`((!labels.exists(l, l=="Extended")) || (labels.exists(l, l=="Extended") && labels.exists(l, l=="ReleaseGate"))) &&
88+
name.contains("[Slow]")`,
8089
},
8190
})
8291

8392
// Suite: olmv1/all
8493
// ---------------------------------------------------------------
8594
// All tests in one suite: includes [Serial], [Slow], [Disruptive], etc.
95+
// Note: It includes the extended cases which match the openshift-tests.
8696
ext.AddSuite(e.Suite{
8797
Name: "olmv1/all",
98+
Qualifiers: []string{
99+
`(!labels.exists(l, l=="Extended")) || (labels.exists(l, l=="Extended") && labels.exists(l, l=="ReleaseGate"))`,
100+
},
101+
})
102+
103+
// Extended Suite: All extended tests
104+
// Contains all extended tests migrated from tests-private repository
105+
ext.AddSuite(e.Suite{
106+
Name: "olmv1/extended",
107+
Qualifiers: []string{
108+
`labels.exists(l, l=="Extended")`,
109+
},
110+
})
111+
112+
// Extended ReleaseGate Suite: extended tests that meet OpenShift CI requirements
113+
// Contains extended tests marked as release gate for openshift-tests
114+
ext.AddSuite(e.Suite{
115+
Name: "olmv1/extended/releasegate",
116+
Qualifiers: []string{
117+
`labels.exists(l, l=="Extended") && labels.exists(l, l=="ReleaseGate")`,
118+
},
119+
})
120+
121+
// Extended Candidate Suite: Extended tests that don't meet OpenShift CI requirements
122+
// Contains extended tests that are not for openshift-tests (run in custom periodic jobs only)
123+
ext.AddSuite(e.Suite{
124+
Name: "olmv1/extended/candidate",
125+
Qualifiers: []string{
126+
`labels.exists(l, l=="Extended") && !labels.exists(l, l=="ReleaseGate")`,
127+
},
128+
})
129+
130+
// Extended Candidate Suite Parallel Suite: extended tests that can run in parallel
131+
// Contains extended tests that can run concurrently (excludes Serial, Slow, and StressTest)
132+
ext.AddSuite(e.Suite{
133+
Name: "olmv1/extended/candidate/parallel",
134+
Qualifiers: []string{
135+
`(labels.exists(l, l=="Extended") && !labels.exists(l, l=="ReleaseGate") && !labels.exists(l, l=="StressTest")) &&
136+
!(name.contains("[Serial]") || name.contains("[Slow]"))`,
137+
},
138+
})
139+
// Extended Candidate Serial Suite: extended tests that must run one at a time
140+
// Contains extended tests marked as [Serial] (includes Disruptive tests since not used for openshift-tests)
141+
ext.AddSuite(e.Suite{
142+
Name: "olmv1/extended/candidate/serial",
143+
Qualifiers: []string{
144+
`(labels.exists(l, l=="Extended") && !labels.exists(l, l=="ReleaseGate") && !labels.exists(l, l=="StressTest")) &&
145+
(name.contains("[Serial]") && !name.contains("[Slow]"))`,
146+
// it is not used for openshift-tests, so it does not exclude Disruptive, so that we could use
147+
// olmv1/extended/candidate/serial to run all serial case including Disruptive cases
148+
},
149+
})
150+
// Extended Candidate Slow Suite: extended tests that take significant time to run
151+
// Contains extended tests marked as [Slow] (long-running tests not suitable for fast CI)
152+
ext.AddSuite(e.Suite{
153+
Name: "olmv1/extended/candidate/slow",
154+
Qualifiers: []string{
155+
`(labels.exists(l, l=="Extended") && !labels.exists(l, l=="ReleaseGate") && !labels.exists(l, l=="StressTest")) &&
156+
name.contains("[Slow]")`,
157+
},
158+
})
159+
// Extended Candidate Stress Suite: extended stress tests
160+
// Contains extended tests designed for stress testing and resource exhaustion scenarios
161+
ext.AddSuite(e.Suite{
162+
Name: "olmv1/extended/candidate/stress",
163+
Qualifiers: []string{
164+
`labels.exists(l, l=="Extended") && !labels.exists(l, l=="ReleaseGate") && labels.exists(l, l=="StressTest")`,
165+
},
88166
})
89167

90168
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
91169
if err != nil {
92170
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
93171
}
94172

173+
// Automatically identify and label extended tests: select all tests from the specs directory and add the "Extended" label
174+
specs.Select(exutil.Olmv1QeTestsOnly()).AddLabel("Extended")
175+
// Process all test specs to apply extended-specific transformations and topology exclusions
176+
specs = specs.Walk(func(spec *et.ExtensionTestSpec) {
177+
if spec.Labels.Has("Extended") {
178+
// Change blocking tests to informing unless marked as ReleaseGate
179+
if !spec.Labels.Has("ReleaseGate") && spec.Lifecycle == "blocking" {
180+
spec.Lifecycle = "informing"
181+
}
182+
// Exclude External topology for NonHyperShiftHOST tests
183+
if spec.Labels.Has("NonHyperShiftHOST") {
184+
spec.Exclude(et.TopologyEquals("External"))
185+
}
186+
// Include External Connecttivity for Disconnected only tests
187+
if strings.Contains(spec.Name, "[Skipped:Connected]") {
188+
spec.Include(et.ExternalConnectivityEquals("Disconnected"))
189+
}
190+
}
191+
})
192+
95193
// Ensure `[Disruptive]` tests are always also marked `[Serial]`.
96194
// This prevents them from running in parallel suites, which could cause flaky failures
97195
// due to disruptive behavior.
@@ -140,6 +238,7 @@ func main() {
140238
// Initialize the environment before running any tests.
141239
specs.AddBeforeAll(func() {
142240
env.Init()
241+
exutil.InitClusterEnv()
143242
})
144243

145244
ext.AddSpecs(specs)

0 commit comments

Comments
 (0)