Skip to content

Commit 5d94d67

Browse files
Merge pull request #1436 from liqcui/single-case-ote
NO-JIRA:Update code for migrating nto test case from openshift-test-private to OTE
2 parents 629b12f + 92c3ea9 commit 5d94d67

File tree

397 files changed

+84187
-5126
lines changed

Some content is hidden

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

397 files changed

+84187
-5126
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ RUN dnf clean all && \
2828
useradd -r -u 499 cluster-node-tuning-operator
2929
ENTRYPOINT ["/usr/bin/cluster-node-tuning-operator"]
3030
LABEL io.k8s.display-name="OpenShift cluster-node-tuning-operator" \
31-
io.k8s.description="This is a component of OpenShift and manages the lifecycle of node-level tuning." \
32-
io.openshift.release.operator=true
31+
io.k8s.description="This is a component of OpenShift and manages the lifecycle of node-level tuning." \
32+
io.openshift.release.operator=true \
33+
io.openshift.tags="openshift,tests,e2e,e2e-extension"

Dockerfile.rhel9

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.21 AS
22
WORKDIR /go/src/github.com/openshift/cluster-node-tuning-operator
33
COPY . .
44
RUN make build
5+
RUN gzip /go/src/github.com/openshift/cluster-node-tuning-operator/_output/cluster-node-tuning-operator-test-ext
56

67
FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
78
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/cluster-node-tuning-operator /usr/bin/
89
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/performance-profile-creator /usr/bin/
910
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/gather-sysinfo /usr/bin/
11+
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/cluster-node-tuning-operator-test-ext.gz /usr/bin/
1012

1113
ENV ASSETS_DIR=/root/assets
1214
COPY assets $ASSETS_DIR
@@ -24,5 +26,6 @@ RUN dnf clean all && \
2426
useradd -r -u 499 cluster-node-tuning-operator
2527
ENTRYPOINT ["/usr/bin/cluster-node-tuning-operator"]
2628
LABEL io.k8s.display-name="OpenShift cluster-node-tuning-operator" \
27-
io.k8s.description="This is a component of OpenShift and manages the lifecycle of node-level tuning." \
28-
io.openshift.release.operator=true
29+
io.k8s.description="This is a component of OpenShift and manages the lifecycle of node-level tuning." \
30+
io.openshift.release.operator=true \
31+
io.openshift.tags="openshift,tests,e2e,e2e-extension"

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ update-tuned-submodule:
7676
git pull origin master && \
7777
git checkout $(TUNED_COMMIT))
7878

79-
build: $(BINDATA) pkg/generated build-performance-profile-creator build-gather-sysinfo
79+
build: $(BINDATA) pkg/generated build-performance-profile-creator build-gather-sysinfo cluster-node-tuning-operator-test-ext
8080
$(GO_BUILD_RECIPE)
8181

8282
$(BINDATA): $(GOBINDATA_BIN) $(ASSETS)
@@ -309,3 +309,9 @@ pao-build-e2e:
309309
.PHONY: pao-clean-e2e
310310
pao-clean-e2e:
311311
@rm -f _output/e2e-pao*.test
312+
313+
314+
.PHONY: cluster-node-tuning-operator-test-ext
315+
cluster-node-tuning-operator-test-ext:
316+
@echo "Building cluster-node-tuning-operator-test-ext"
317+
GO_COMPLIANCE_POLICY=exempt_all CGO_ENABLED=0 $(GO) build -mod=vendor -v -o $(OUT_DIR)/cluster-node-tuning-operator-test-ext ./cmd/cluster-node-tuning-operator-test-ext
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
This command is used to run the Cluster OpenShift Cluster Node Tuning Operator tests extension for OpenShift.
3+
4+
It registers the Cluster Node Tuning Operator tests with the OpenShift Tests Extension framework and provides a command-line interface to execute them.
5+
6+
For further information, please refer to the documentation at:
7+
https://github.com/openshift-eng/openshift-tests-extension/blob/main/cmd/example-tests/main.go
8+
*/
9+
package main
10+
11+
import (
12+
"fmt"
13+
"os"
14+
"strings"
15+
16+
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
17+
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
18+
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
19+
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
20+
21+
"github.com/spf13/cobra"
22+
23+
// The import below is necessary to ensure that the NTO operator tests are registered with the extension.
24+
_ "github.com/openshift/cluster-node-tuning-operator/test/extended"
25+
)
26+
27+
func main() {
28+
registry := e.NewRegistry()
29+
ext := e.NewExtension("openshift", "payload", "cluster-node-tuning-operator")
30+
31+
// Suite: conformance/parallel (fast, parallel-safe)
32+
ext.AddSuite(e.Suite{
33+
Name: "openshift/cluster-node-tuning-operator/conformance/parallel",
34+
Parents: []string{"openshift/conformance/parallel"},
35+
Qualifiers: []string{
36+
`!(name.contains("[Serial]") || name.contains("[Slow]"))`,
37+
},
38+
})
39+
40+
// Suite: conformance/serial (explicitly serial tests)
41+
ext.AddSuite(e.Suite{
42+
Name: "openshift/cluster-node-tuning-operator/conformance/serial",
43+
Parents: []string{"openshift/conformance/serial"},
44+
Qualifiers: []string{
45+
`name.contains("[Serial]")`,
46+
},
47+
})
48+
49+
// Suite: optional/slow (long-running tests)
50+
ext.AddSuite(e.Suite{
51+
Name: "openshift/cluster-node-tuning-operator/optional/slow",
52+
Parents: []string{"openshift/optional/slow"},
53+
Qualifiers: []string{
54+
`name.contains("[Slow]")`,
55+
},
56+
})
57+
58+
// Suite: all (includes everything)
59+
ext.AddSuite(e.Suite{
60+
Name: "openshift/cluster-node-tuning-operator/all",
61+
})
62+
63+
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
64+
if err != nil {
65+
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
66+
}
67+
68+
// Ensure [Disruptive] tests are also [Serial]
69+
specs = specs.Walk(func(spec *et.ExtensionTestSpec) {
70+
if strings.Contains(spec.Name, "[Disruptive]") && !strings.Contains(spec.Name, "[Serial]") {
71+
spec.Name = strings.ReplaceAll(
72+
spec.Name,
73+
"[Disruptive]",
74+
"[Serial][Disruptive]",
75+
)
76+
}
77+
})
78+
79+
// Preserve original-name labels for renamed tests
80+
specs = specs.Walk(func(spec *et.ExtensionTestSpec) {
81+
for label := range spec.Labels {
82+
if strings.HasPrefix(label, "original-name:") {
83+
parts := strings.SplitN(label, "original-name:", 2)
84+
if len(parts) > 1 {
85+
spec.OriginalName = parts[1]
86+
}
87+
}
88+
}
89+
})
90+
91+
// Ignore obsolete tests
92+
ext.IgnoreObsoleteTests(
93+
// "[sig-node-tuning] <test name here>",
94+
)
95+
96+
// Initialize environment before running any tests
97+
specs.AddBeforeAll(func() {
98+
// do stuff
99+
})
100+
101+
ext.AddSpecs(specs)
102+
registry.Register(ext)
103+
104+
root := &cobra.Command{
105+
Long: "Cluster Node Tuning Operator Tests Extension",
106+
}
107+
108+
root.AddCommand(cmd.DefaultExtensionCommands(registry)...)
109+
110+
if err := root.Execute(); err != nil {
111+
os.Exit(1)
112+
}
113+
}

go.mod

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ require (
1414
github.com/kevinburke/go-bindata v3.24.0+incompatible
1515
github.com/onsi/ginkgo/v2 v2.27.2
1616
github.com/onsi/gomega v1.38.2
17+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250825124651-f7d932f33eb1
1718
github.com/openshift-kni/debug-tools v0.2.6
1819
github.com/openshift-kni/k8sreporter v1.0.7
1920
github.com/openshift/api v0.0.0-20251120040117-916c7003ed78
@@ -45,8 +46,9 @@ require (
4546
)
4647

4748
require (
48-
github.com/Masterminds/semver/v3 v3.4.0 // indirect
49+
cel.dev/expr v0.24.0 // indirect
4950
github.com/ajeddeloh/go-json v0.0.0-20200220154158-5ae607161559 // indirect
51+
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
5052
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
5153
github.com/beorn7/perks v1.0.1 // indirect
5254
github.com/blang/semver/v4 v4.0.0 // indirect
@@ -78,6 +80,7 @@ require (
7880
github.com/gogo/protobuf v1.3.2 // indirect
7981
github.com/google/btree v1.1.3 // indirect
8082
github.com/google/cadvisor v0.52.1 // indirect
83+
github.com/google/cel-go v0.26.0 // indirect
8184
github.com/google/gnostic-models v0.7.0 // indirect
8285
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
8386
github.com/google/uuid v1.6.0 // indirect
@@ -104,6 +107,7 @@ require (
104107
github.com/prometheus/common v0.66.1 // indirect
105108
github.com/prometheus/procfs v0.16.1 // indirect
106109
github.com/robfig/cron v1.2.0 // indirect
110+
github.com/stoewer/go-strcase v1.3.0 // indirect
107111
github.com/vincent-petithory/dataurl v1.0.0 // indirect
108112
github.com/x448/float16 v0.8.4 // indirect
109113
github.com/yusufpapurcu/wmi v1.2.4 // indirect
@@ -115,6 +119,7 @@ require (
115119
go.yaml.in/yaml/v2 v2.4.2 // indirect
116120
go.yaml.in/yaml/v3 v3.0.4 // indirect
117121
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
122+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
118123
golang.org/x/mod v0.28.0 // indirect
119124
golang.org/x/net v0.46.0 // indirect
120125
golang.org/x/oauth2 v0.32.0 // indirect
@@ -125,6 +130,7 @@ require (
125130
golang.org/x/time v0.13.0 // indirect
126131
golang.org/x/tools v0.37.0 // indirect
127132
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
133+
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
128134
google.golang.org/genproto/googleapis/rpc v0.0.0-20251002232023-7c0ddcbb5797 // indirect
129135
google.golang.org/grpc v1.75.1 // indirect
130136
google.golang.org/protobuf v1.36.10 // indirect
@@ -173,3 +179,8 @@ replace (
173179
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.34.2
174180
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.34.2
175181
)
182+
183+
// All the pinned dependencies are a technical debt of this or upstream projects that needs to be fixed.
184+
// Required for openshift-tests-extension compatibility (uses OpenShift's ginkgo fork).
185+
// Without this override cluster-node-tuning-operator-test-ext doesn't compile.
186+
replace github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12

0 commit comments

Comments
 (0)