Skip to content

Commit 5be7805

Browse files
committed
Add OTE (openshift-tests-extension) entry point: release-4.15
- Mirror of PR openshift#260 for release-4.15 - Original commit message and fix by @mandre Add cmd/extension/main.go as a new OTE-based test extension binary alongside the existing openshift-tests entry point. This registers all openstack tests with the OTE framework, adds [OTP] annotations to all Describe blocks, and integrates the extension build into the Makefile and Containerfile. The OTE binary discovers 44 tests and does not pull in origin's monitor test framework, avoiding the duplicate test results seen with the old entry point. Signed-off-by: Dan Childers <dchilder@redhat.com>
1 parent 26836ee commit 5be7805

818 files changed

Lines changed: 49918 additions & 21278 deletions

File tree

Some content is hidden

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

Containerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,24 @@ COPY ./ ./
77

88
RUN go build -o /bin/openstack-test ./cmd/openshift-tests
99

10+
# Test extension builder stage (added by ote-migration)
11+
FROM golang:1.21 AS test-extension-builder
12+
RUN mkdir -p /go/src/github.com/openshift/openstack-test
13+
WORKDIR /go/src/github.com/openshift/openstack-test
14+
COPY . .
15+
RUN make tests-ext-build && \
16+
cd bin && \
17+
tar -czvf openstack-test-test-extension.tar.gz openstack-test-tests-ext && \
18+
rm -f openstack-test-tests-ext
19+
1020
# Will be replaced in the CI with registry.ci.openshift.org/ocp/4.y:tools
1121
FROM registry.access.redhat.com/ubi8/ubi
1222

1323
COPY --from=builder /bin/openstack-test /usr/bin/
1424

25+
# Copy test extension binary (added by ote-migration)
26+
COPY --from=test-extension-builder /go/src/github.com/openshift/openstack-test/bin/openstack-test-test-extension.tar.gz /usr/bin/
27+
1528
USER 1000:1000
1629
ENV LC_ALL en_US.UTF-8
1730

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
openstack-tests: test/extended/openstack/*
2+
openstack-tests: test/extended/openstack/* cmd/openshift-tests/*
33
go build -o $@ ./cmd/openshift-tests
44

55
# Update generated artifacts.
@@ -14,3 +14,21 @@ verify:
1414
run: openstack-tests
1515
./$< run openshift/openstack
1616
.PHONY: run
17+
18+
# OTE test extension binary configuration
19+
TESTS_EXT_BINARY := bin/openstack-test-tests-ext
20+
21+
.PHONY: tests-ext-build
22+
tests-ext-build:
23+
@echo "Building OTE test extension binary..."
24+
@mkdir -p bin
25+
GOTOOLCHAIN=auto GOSUMDB=sum.golang.org go build -mod=vendor -o $(TESTS_EXT_BINARY) ./cmd/extension
26+
@echo "Extension binary built: $(TESTS_EXT_BINARY)"
27+
28+
.PHONY: extension
29+
extension: tests-ext-build
30+
31+
.PHONY: clean-extension
32+
clean-extension:
33+
@echo "Cleaning extension binary..."
34+
@rm -f $(TESTS_EXT_BINARY)

cmd/extension/main.go

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"os"
7+
"regexp"
8+
"strings"
9+
10+
"github.com/spf13/cobra"
11+
"github.com/spf13/pflag"
12+
"k8s.io/component-base/logs"
13+
14+
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
15+
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
16+
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
17+
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
18+
"github.com/openshift/origin/test/extended/util"
19+
framework "k8s.io/kubernetes/test/e2e/framework"
20+
21+
_ "github.com/openshift/openstack-test/test/extended/openstack"
22+
)
23+
24+
func main() {
25+
pflag.CommandLine = pflag.NewFlagSet("empty", pflag.ExitOnError)
26+
flag.CommandLine = flag.NewFlagSet("empty", flag.ExitOnError)
27+
util.InitStandardFlags()
28+
framework.AfterReadingAllFlags(&framework.TestContext)
29+
30+
logs.InitLogs()
31+
defer logs.FlushLogs()
32+
33+
registry := e.NewRegistry()
34+
ext := e.NewExtension("openshift", "payload", "openstack-test")
35+
36+
registerSuites(ext)
37+
38+
allSpecs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
39+
if err != nil {
40+
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
41+
}
42+
43+
componentSpecs := allSpecs.Select(func(spec *et.ExtensionTestSpec) bool {
44+
for _, loc := range spec.CodeLocations {
45+
if strings.Contains(loc, "/test/extended/openstack/") && !strings.Contains(loc, "/go/pkg/mod/") && !strings.Contains(loc, "/vendor/") {
46+
return true
47+
}
48+
}
49+
return false
50+
})
51+
52+
componentSpecs.AddBeforeAll(func() {
53+
if err := util.InitTest(false); err != nil {
54+
panic(err)
55+
}
56+
util.WithCleanup(func() {})
57+
})
58+
59+
componentSpecs.Walk(func(spec *et.ExtensionTestSpec) {
60+
for label := range spec.Labels {
61+
if strings.HasPrefix(label, "Platform:") {
62+
platformName := strings.TrimPrefix(label, "Platform:")
63+
spec.Include(et.PlatformEquals(platformName))
64+
}
65+
}
66+
67+
re := regexp.MustCompile(`\[platform:([a-z]+)\]`)
68+
if match := re.FindStringSubmatch(spec.Name); match != nil {
69+
platform := match[1]
70+
spec.Include(et.PlatformEquals(platform))
71+
}
72+
73+
spec.Lifecycle = et.LifecycleInforming
74+
})
75+
76+
ext.AddSpecs(componentSpecs)
77+
78+
registry.Register(ext)
79+
80+
root := &cobra.Command{
81+
Long: "Openstack-test Tests",
82+
}
83+
84+
root.AddCommand(cmd.DefaultExtensionCommands(registry)...)
85+
86+
if err := func() error {
87+
return root.Execute()
88+
}(); err != nil {
89+
os.Exit(1)
90+
}
91+
}
92+
93+
func registerSuites(ext *e.Extension) {
94+
suites := []e.Suite{
95+
{
96+
Name: "openstack-test/conformance/parallel",
97+
Parents: []string{
98+
"openshift/conformance/parallel",
99+
},
100+
Description: "Parallel conformance tests (Level0, non-serial, non-disruptive)",
101+
Qualifiers: []string{
102+
`name.contains("[Level0]") && !(name.contains("[Serial]") || name.contains("[Disruptive]"))`,
103+
},
104+
},
105+
{
106+
Name: "openstack-test/conformance/serial",
107+
Parents: []string{
108+
"openshift/conformance/serial",
109+
},
110+
Description: "Serial conformance tests (must run sequentially)",
111+
Qualifiers: []string{
112+
`name.contains("[Level0]") && name.contains("[Serial]") && !name.contains("[Disruptive]")`,
113+
},
114+
},
115+
{
116+
Name: "openstack-test/disruptive",
117+
Parents: []string{"openshift/disruptive"},
118+
Description: "Disruptive tests (may affect cluster state)",
119+
Qualifiers: []string{
120+
`name.contains("[Disruptive]")`,
121+
},
122+
},
123+
{
124+
Name: "openstack-test/non-disruptive",
125+
Description: "All non-disruptive tests (safe for development clusters)",
126+
Qualifiers: []string{
127+
`!name.contains("[Disruptive]")`,
128+
},
129+
},
130+
{
131+
Name: "openstack-test/all",
132+
Description: "All openstack-test tests",
133+
},
134+
}
135+
136+
for _, suite := range suites {
137+
ext.AddSuite(suite)
138+
}
139+
}

go.mod

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
module github.com/openshift/openstack-test
22

3-
go 1.20
3+
go 1.23.0
44

55
require (
66
github.com/gophercloud/gophercloud v1.11.0
77
github.com/gophercloud/utils v0.0.0-20230523080330-de873b9cf00d
8+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260616194104-220cea40cb1c
89
github.com/openshift/origin v1.5.0-alpha.3.0.20230609045613-8db5731e8d00
910
)
1011

1112
require (
1213
github.com/Masterminds/semver v1.5.0
13-
github.com/onsi/ginkgo/v2 v2.9.5
14-
github.com/onsi/gomega v1.27.7
14+
github.com/onsi/ginkgo/v2 v2.21.0
15+
github.com/onsi/gomega v1.35.1
1516
github.com/openshift/api v0.0.0-20230524230522-75b5a44dbeeb
1617
github.com/openshift/client-go v0.0.0-20230503144108-75015d2347cb
1718
github.com/openshift/cluster-api-actuator-pkg v0.0.0-20230607151420-7c2c65b42170
1819
github.com/openshift/library-go v0.0.0-20230523150659-ab179469ba38
1920
github.com/pkg/errors v0.9.1
2021
github.com/sirupsen/logrus v1.9.0
21-
github.com/spf13/cobra v1.6.1
22+
github.com/spf13/cobra v1.8.1
2223
github.com/spf13/pflag v1.0.5
23-
github.com/stretchr/objx v0.5.0
24-
github.com/stretchr/testify v1.8.2
24+
github.com/stretchr/objx v0.5.2
25+
github.com/stretchr/testify v1.9.0
2526
gopkg.in/ini.v1 v1.67.0
2627
gopkg.in/yaml.v2 v2.4.0
2728
k8s.io/api v0.27.2
28-
k8s.io/apimachinery v0.27.2
29+
k8s.io/apimachinery v0.31.1
2930
k8s.io/cli-runtime v0.27.1
3031
k8s.io/client-go v0.27.2
3132
k8s.io/component-base v0.27.2
3233
k8s.io/klog/v2 v2.100.1
3334
k8s.io/kubectl v0.27.1
3435
k8s.io/kubernetes v1.27.1
3536
k8s.io/pod-security-admission v0.27.1
37+
k8s.io/utils v0.0.0-20240310230437-4693a0247e57
3638
sigs.k8s.io/controller-runtime v0.15.0
3739
)
3840

@@ -76,7 +78,7 @@ require (
7678
github.com/coreos/go-semver v0.3.0 // indirect
7779
github.com/coreos/go-systemd/v22 v22.4.0 // indirect
7880
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
79-
github.com/davecgh/go-spew v1.1.1 // indirect
81+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
8082
github.com/docker/distribution v2.8.1+incompatible // indirect
8183
github.com/docker/docker v20.10.21+incompatible // indirect
8284
github.com/docker/go-connections v0.4.0 // indirect
@@ -94,12 +96,12 @@ require (
9496
github.com/fsouza/go-dockerclient v1.7.1 // indirect
9597
github.com/ghodss/yaml v1.0.0 // indirect
9698
github.com/go-errors/errors v1.4.2 // indirect
97-
github.com/go-logr/logr v1.2.4 // indirect
99+
github.com/go-logr/logr v1.4.2 // indirect
98100
github.com/go-logr/stdr v1.2.2 // indirect
99101
github.com/go-openapi/jsonpointer v0.19.6 // indirect
100102
github.com/go-openapi/jsonreference v0.20.2 // indirect
101103
github.com/go-openapi/swag v0.22.3 // indirect
102-
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
104+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
103105
github.com/godbus/dbus/v5 v5.0.6 // indirect
104106
github.com/gofrs/uuid v4.0.0+incompatible // indirect
105107
github.com/gogo/protobuf v1.3.2 // indirect
@@ -109,11 +111,11 @@ require (
109111
github.com/golang/protobuf v1.5.3 // indirect
110112
github.com/google/btree v1.0.1 // indirect
111113
github.com/google/cadvisor v0.47.1 // indirect
112-
github.com/google/cel-go v0.12.6 // indirect
114+
github.com/google/cel-go v0.17.8 // indirect
113115
github.com/google/gnostic v0.6.9 // indirect
114-
github.com/google/go-cmp v0.5.9 // indirect
116+
github.com/google/go-cmp v0.6.0 // indirect
115117
github.com/google/gofuzz v1.2.0 // indirect
116-
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
118+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
117119
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
118120
github.com/google/uuid v1.3.0 // indirect
119121
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
@@ -123,7 +125,7 @@ require (
123125
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
124126
github.com/hashicorp/go-uuid v1.0.3 // indirect
125127
github.com/imdario/mergo v0.3.13 // indirect
126-
github.com/inconshreveable/mousetrap v1.0.1 // indirect
128+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
127129
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
128130
github.com/josharian/intern v1.0.0 // indirect
129131
github.com/json-iterator/go v1.1.12 // indirect
@@ -163,7 +165,7 @@ require (
163165
github.com/pborman/uuid v1.2.0 // indirect
164166
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
165167
github.com/pkg/profile v1.3.0 // indirect
166-
github.com/pmezard/go-difflib v1.0.0 // indirect
168+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
167169
github.com/prometheus/client_golang v1.15.1 // indirect
168170
github.com/prometheus/client_model v0.4.0 // indirect
169171
github.com/prometheus/common v0.42.0 // indirect
@@ -199,21 +201,21 @@ require (
199201
go.uber.org/atomic v1.9.0 // indirect
200202
go.uber.org/multierr v1.8.0 // indirect
201203
go.uber.org/zap v1.24.0 // indirect
202-
golang.org/x/crypto v0.1.0 // indirect
203-
golang.org/x/net v0.10.0 // indirect
204+
golang.org/x/crypto v0.28.0 // indirect
205+
golang.org/x/net v0.30.0 // indirect
204206
golang.org/x/oauth2 v0.6.0 // indirect
205-
golang.org/x/sync v0.2.0 // indirect
206-
golang.org/x/sys v0.8.0 // indirect
207-
golang.org/x/term v0.8.0 // indirect
208-
golang.org/x/text v0.9.0 // indirect
207+
golang.org/x/sync v0.8.0 // indirect
208+
golang.org/x/sys v0.26.0 // indirect
209+
golang.org/x/term v0.25.0 // indirect
210+
golang.org/x/text v0.19.0 // indirect
209211
golang.org/x/time v0.3.0 // indirect
210-
golang.org/x/tools v0.9.1 // indirect
212+
golang.org/x/tools v0.26.0 // indirect
211213
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
212214
google.golang.org/api v0.107.0 // indirect
213215
google.golang.org/appengine v1.6.7 // indirect
214216
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect
215217
google.golang.org/grpc v1.52.0 // indirect
216-
google.golang.org/protobuf v1.30.0 // indirect
218+
google.golang.org/protobuf v1.35.1 // indirect
217219
gopkg.in/gcfg.v1 v1.2.3 // indirect
218220
gopkg.in/inf.v0 v0.9.1 // indirect
219221
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
@@ -241,7 +243,6 @@ require (
241243
k8s.io/metrics v0.0.0 // indirect
242244
k8s.io/mount-utils v0.0.0 // indirect
243245
k8s.io/sample-apiserver v0.0.0 // indirect
244-
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
245246
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.1.2 // indirect
246247
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
247248
sigs.k8s.io/kube-storage-version-migrator v0.0.4 // indirect
@@ -252,7 +253,9 @@ require (
252253
)
253254

254255
replace (
255-
github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20230317131656-c62d9de5a460
256+
github.com/google/cel-go => github.com/google/cel-go v0.12.6
257+
github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12
258+
google.golang.org/protobuf => google.golang.org/protobuf v1.30.0
256259
k8s.io/api => github.com/openshift/kubernetes/staging/src/k8s.io/api v0.0.0-20230525170236-15f19ea2dd70
257260
k8s.io/apiextensions-apiserver => github.com/openshift/kubernetes/staging/src/k8s.io/apiextensions-apiserver v0.0.0-20230525170236-15f19ea2dd70
258261
k8s.io/apimachinery => github.com/openshift/kubernetes/staging/src/k8s.io/apimachinery v0.0.0-20230525170236-15f19ea2dd70

0 commit comments

Comments
 (0)