Skip to content

Commit e06c84b

Browse files
Merge pull request #1488 from gangwgr/ote-etcd-operator
CNTRLPLANE-1315:Add OpenShift Tests Extension (OTE) for cluster-etcd-operator
2 parents 106d42f + 7ec46f5 commit e06c84b

File tree

298 files changed

+199174
-11
lines changed

Some content is hidden

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

298 files changed

+199174
-11
lines changed

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,14 @@ tnf-setup-runner
1717
telepresence.log
1818
# Goland
1919
.idea
20-
_output
20+
_output
21+
cluster-etcd-operator-tests-ext
22+
cluster-etcd-operator-tests-ext.gz
23+
24+
# Test output files
25+
junit.xml
26+
report.json
27+
test-results/
28+
29+
# OpenShift Tests Extension metadata
30+
.openshift-tests-extension/openshift_payload_*.json

Dockerfile.ocp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.21 AS
22
WORKDIR /go/src/github.com/openshift/cluster-etcd-operator
33
COPY . .
44
ENV GO_PACKAGE github.com/openshift/cluster-etcd-operator
5-
RUN make build --warn-undefined-variables
5+
RUN make build --warn-undefined-variables \
6+
&& make tests-ext-build \
7+
&& gzip cluster-etcd-operator-tests-ext
68

79
FROM registry.ci.openshift.org/ocp/4.21:base-rhel9
810
COPY --from=builder /go/src/github.com/openshift/cluster-etcd-operator/bindata/bootkube/bootstrap-manifests /usr/share/bootkube/manifests/bootstrap-manifests/
911
COPY --from=builder /go/src/github.com/openshift/cluster-etcd-operator/bindata/bootkube/manifests /usr/share/bootkube/manifests/manifests/
1012
COPY --from=builder /go/src/github.com/openshift/cluster-etcd-operator/cluster-etcd-operator /usr/bin/
1113
COPY --from=builder /go/src/github.com/openshift/cluster-etcd-operator/tnf-setup-runner /usr/bin/
14+
COPY --from=builder /go/src/github.com/openshift/cluster-etcd-operator/cluster-etcd-operator-tests-ext.gz /usr/bin/
1215
COPY manifests/ /manifests
1316

1417
LABEL io.openshift.release.operator true

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
1111

1212
IMAGE_REGISTRY :=registry.svc.ci.openshift.org
1313

14+
# OpenShift Tests Extension variables
15+
TESTS_EXT_BINARY ?= cluster-etcd-operator-tests-ext
16+
TESTS_EXT_PACKAGE ?= ./cmd/cluster-etcd-operator-tests-ext
17+
TESTS_EXT_LDFLAGS ?= -X 'main.CommitFromGit=$(shell git rev-parse --short HEAD)' \
18+
-X 'main.BuildDate=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)' \
19+
-X 'main.GitTreeState=$(shell if git diff-index --quiet HEAD --; then echo clean; else echo dirty; fi)'
20+
GOOS ?= linux
21+
GOARCH ?= amd64
22+
1423
# This will call a macro called "build-image" which will generate image specific targets based on the parameters:
1524
# $0 - macro name
1625
# $1 - target name
@@ -36,3 +45,19 @@ test-e2e: GO_TEST_FLAGS += -timeout 2h
3645
test-e2e: GO_TEST_FLAGS += -p 1
3746
test-e2e: test-unit
3847
.PHONY: test-e2e
48+
49+
# Build the openshift-tests-extension binary
50+
.PHONY: tests-ext-build
51+
tests-ext-build:
52+
GOOS=$(GOOS) GOARCH=$(GOARCH) GO_COMPLIANCE_POLICY=exempt_all CGO_ENABLED=0 \
53+
go build -o $(TESTS_EXT_BINARY) -ldflags "$(TESTS_EXT_LDFLAGS)" $(TESTS_EXT_PACKAGE)
54+
55+
# Update test metadata
56+
.PHONY: tests-ext-update
57+
tests-ext-update:
58+
./$(TESTS_EXT_BINARY) update
59+
60+
# Clean tests extension artifacts
61+
.PHONY: tests-ext-clean
62+
tests-ext-clean:
63+
rm -f $(TESTS_EXT_BINARY) $(TESTS_EXT_BINARY).gz
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"strings"
7+
8+
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
9+
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
10+
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
11+
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
12+
13+
"github.com/spf13/cobra"
14+
15+
// The import below is necessary to ensure that the cluster etcd operator tests are registered with the extension.
16+
_ "github.com/openshift/cluster-etcd-operator/test/extended"
17+
)
18+
19+
func main() {
20+
registry := e.NewRegistry()
21+
ext := e.NewExtension("openshift", "payload", "cluster-etcd-operator")
22+
23+
// Suite: conformance/parallel (fast, parallel-safe)
24+
ext.AddSuite(e.Suite{
25+
Name: "openshift/cluster-etcd-operator/conformance/parallel",
26+
Parents: []string{"openshift/conformance/parallel"},
27+
Qualifiers: []string{
28+
`!(name.contains("[Serial]") || name.contains("[Slow]"))`,
29+
},
30+
})
31+
32+
// Suite: conformance/serial (explicitly serial tests)
33+
ext.AddSuite(e.Suite{
34+
Name: "openshift/cluster-etcd-operator/conformance/serial",
35+
Parents: []string{"openshift/conformance/serial"},
36+
Qualifiers: []string{
37+
`name.contains("[Serial]")`,
38+
},
39+
})
40+
41+
// Suite: optional/slow (long-running tests)
42+
ext.AddSuite(e.Suite{
43+
Name: "openshift/cluster-etcd-operator/optional/slow",
44+
Parents: []string{"openshift/optional/slow"},
45+
Qualifiers: []string{
46+
`name.contains("[Slow]")`,
47+
},
48+
})
49+
50+
// Suite: all (includes everything)
51+
ext.AddSuite(e.Suite{
52+
Name: "openshift/cluster-etcd-operator/all",
53+
})
54+
55+
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
56+
if err != nil {
57+
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
58+
}
59+
60+
// Ensure [Disruptive] tests are also [Serial] (for any future tests that might need this)
61+
specs = specs.Walk(func(spec *et.ExtensionTestSpec) {
62+
if strings.Contains(spec.Name, "[Disruptive]") && !strings.Contains(spec.Name, "[Serial]") {
63+
spec.Name = strings.ReplaceAll(
64+
spec.Name,
65+
"[Disruptive]",
66+
"[Serial][Disruptive]",
67+
)
68+
}
69+
})
70+
71+
// Preserve original-name labels for renamed tests
72+
specs = specs.Walk(func(spec *et.ExtensionTestSpec) {
73+
for label := range spec.Labels {
74+
if strings.HasPrefix(label, "original-name:") {
75+
parts := strings.SplitN(label, "original-name:", 2)
76+
if len(parts) > 1 {
77+
spec.OriginalName = parts[1]
78+
}
79+
}
80+
}
81+
})
82+
83+
// Ignore obsolete tests
84+
ext.IgnoreObsoleteTests(
85+
// "[sig-etcd] <test name here>",
86+
)
87+
88+
// Initialize environment before running any tests
89+
specs.AddBeforeAll(func() {
90+
// do stuff
91+
})
92+
93+
ext.AddSpecs(specs)
94+
registry.Register(ext)
95+
96+
root := &cobra.Command{
97+
Long: "Cluster Etcd Operator Tests Extension",
98+
}
99+
100+
root.AddCommand(cmd.DefaultExtensionCommands(registry)...)
101+
102+
if err := root.Execute(); err != nil {
103+
os.Exit(1)
104+
}
105+
}

go.mod

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ require (
99
github.com/ghodss/yaml v1.0.0
1010
github.com/google/go-cmp v0.7.0
1111
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
12+
github.com/onsi/ginkgo/v2 v2.21.0
13+
github.com/onsi/gomega v1.35.1
14+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250804142706-7b3ab438a292
1215
github.com/openshift/api v0.0.0-20250710004639-926605d3338b
1316
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee
1417
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee
@@ -64,14 +67,15 @@ require (
6467
github.com/go-openapi/jsonpointer v0.21.0 // indirect
6568
github.com/go-openapi/jsonreference v0.20.2 // indirect
6669
github.com/go-openapi/swag v0.23.0 // indirect
70+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
6771
github.com/gogo/protobuf v1.3.2 // indirect
6872
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
6973
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
7074
github.com/golang/protobuf v1.5.4 // indirect
7175
github.com/google/btree v1.1.3 // indirect
7276
github.com/google/cel-go v0.23.2 // indirect
7377
github.com/google/gnostic-models v0.6.9 // indirect
74-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
78+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
7579
github.com/google/uuid v1.6.0 // indirect
7680
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
7781
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
@@ -121,6 +125,7 @@ require (
121125
golang.org/x/term v0.30.0 // indirect
122126
golang.org/x/text v0.23.0 // indirect
123127
golang.org/x/time v0.9.0 // indirect
128+
golang.org/x/tools v0.28.0 // indirect
124129
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
125130
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
126131
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
@@ -141,5 +146,6 @@ require (
141146

142147
replace (
143148
github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
149+
github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12
144150
vbom.ml/util => github.com/fvbommel/util v0.0.0-20180919145318-efcd4e0f9787
145151
)

go.sum

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+
136136
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
137137
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
138138
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
139-
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
140139
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
141140
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
142141
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
@@ -197,8 +196,8 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI
197196
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
198197
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg=
199198
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
200-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
201-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
199+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
200+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
202201
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
203202
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
204203
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@@ -312,10 +311,10 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRW
312311
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
313312
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
314313
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
315-
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
316-
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
317314
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
318315
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
316+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250804142706-7b3ab438a292 h1:3athg6KQ+TaNfW4BWZDlGFt1ImSZEJWgzXtPC1VPITI=
317+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250804142706-7b3ab438a292/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
319318
github.com/openshift/api v0.0.0-20250710004639-926605d3338b h1:A8OY6adT2aZNp7tsGsilHuQ3RqhzrFx5dzGr/UwXfJg=
320319
github.com/openshift/api v0.0.0-20250710004639-926605d3338b/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
321320
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee h1:+Sp5GGnjHDhT/a/nQ1xdp43UscBMr7G5wxsYotyhzJ4=
@@ -324,6 +323,8 @@ github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee h1:tOtrrxfDEW8
324323
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee/go.mod h1:zhRiYyNMk89llof2qEuGPWPD+joQPhCRUc2IK0SB510=
325324
github.com/openshift/library-go v0.0.0-20250729191057-91376e1b394e h1:xYT+P++PSc9G+Y47pIcU9fm8IDV/tg6tMi3i+0m23pU=
326325
github.com/openshift/library-go v0.0.0-20250729191057-91376e1b394e/go.mod h1:tptKNust9MdRI0p90DoBSPHIrBa9oh+Rok59tF0vT8c=
326+
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12 h1:AKx/w1qpS8We43bsRgf8Nll3CGlDHpr/WAXvuedTNZI=
327+
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
327328
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
328329
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
329330
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
@@ -670,8 +671,8 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK
670671
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
671672
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
672673
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
673-
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
674-
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
674+
golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8=
675+
golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw=
675676
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
676677
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
677678
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

pkg/cmd/render/bootstrap_ip_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build linux
2+
13
package render
24

35
import (

0 commit comments

Comments
 (0)