Skip to content

Commit 0b9b766

Browse files
jadhajclaude
andcommitted
Add OpenShift Tests Extension (OTE) for baremetal E2E tests
Add OTE test extension binary and migrate 6 baremetal E2E tests from openshift-tests-private using the compat_otp library. Changes: - Add cmd/cluster-baremetal-tests-ext/main.go: OTE binary entry point - Add test/e2e/baremetal/deployment_sanity.go: 6 migrated baremetal tests - Add test/e2e/baremetal/utils.go: Helper functions using compat_otp - Update Makefile: Add build-tests target with -mod=mod approach - Update go.mod: Add 4 OTE dependencies (go 1.25.0 required by origin) - Update go.sum: Add checksums for OTE dependencies OTE builds use -mod=mod flag to download dependencies to module cache instead of vendor/, keeping this PR reviewable (6 files vs 10k+ files). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 6a7e66f commit 0b9b766

6 files changed

Lines changed: 1076 additions & 27 deletions

File tree

Makefile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ CONTAINER_TOOL ?= docker
1010
# Image URL to use all building/pushing image targets
1111
IMG ?= controller:latest
1212

13-
CONTROLLER_GEN ?= go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go
13+
CONTROLLER_GEN ?= GOFLAGS=-mod=mod go run sigs.k8s.io/controller-tools/cmd/controller-gen
1414
CRD_OPTIONS="crd:crdVersions=v1"
15-
GOLANGCI_LINT ?= GOLANGCI_LINT_CACHE=$(GOLANGCI_LINT_CACHE) go run vendor/github.com/golangci/golangci-lint/v2/cmd/golangci-lint/main.go
16-
KUSTOMIZE ?= go run sigs.k8s.io/kustomize/kustomize/v4
15+
GOLANGCI_LINT ?= GOLANGCI_LINT_CACHE=$(GOLANGCI_LINT_CACHE) GOFLAGS=-mod=mod go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint
16+
KUSTOMIZE ?= GOFLAGS=-mod=mod go run sigs.k8s.io/kustomize/kustomize/v4
1717
MANIFEST_PROFILE ?= default
1818
TMP_DIR := $(shell mktemp -d -t manifests-$(date +%Y-%m-%d-%H-%M-%S)-XXXXXXXXXX)
1919

@@ -25,8 +25,9 @@ VERBOSE ?= ""
2525
all: generate lint build
2626

2727
# Run unit tests
28+
# Uses GOFLAGS=-mod=mod to ignore vendor/ directory
2829
unit:
29-
go test $(VERBOSE) ./... -coverprofile cover.out
30+
GOFLAGS=-mod=mod go test $(VERBOSE) ./... -coverprofile cover.out
3031

3132
# Run tests
3233
test: generate lint manifests unit
@@ -35,6 +36,18 @@ test: generate lint manifests unit
3536
build:
3637
go build -o bin/cluster-baremetal-operator main.go
3738

39+
# Build OTE test extension binary
40+
# GONOSUMDB bypasses checksum verification for origin module - required because origin uses pseudo-versions not in public checksum database
41+
# CGO_ENABLED=0 produces static binary for container compatibility
42+
# GO_COMPLIANCE_POLICY="exempt_all" is OpenShift-specific variable that exempts test binaries from internal compliance checks
43+
# - Used consistently across OpenShift test extensions (see openshift-tests, oc-tests-ext, etc.)
44+
# - Blanket exemption is standard for test-only binaries that don't ship to customers
45+
# - Test extensions run in CI environments only, not in production clusters
46+
build-tests:
47+
GONOSUMDB="github.com/openshift/origin" CGO_ENABLED=0 GO_COMPLIANCE_POLICY="exempt_all" \
48+
go build -mod=mod -o bin/cluster-baremetal-tests-ext ./cmd/cluster-baremetal-tests-ext
49+
gzip -f bin/cluster-baremetal-tests-ext
50+
3851
# Run against the configured Kubernetes cluster in ~/.kube/config
3952
run: generate manifests
4053
go run ./main.go -images-json $(IMAGES_JSON)
@@ -100,6 +113,8 @@ manifests: generate
100113
fmt:
101114

102115
# Run go lint against code
116+
# Uses GOFLAGS=-mod=mod to ignore vendor/ directory which may be out of sync with go.mod
117+
# This allows OTE dependencies in go.mod without requiring vendor/ sync
103118
.PHONY: lint
104119
lint:
105120
$(GOLANGCI_LINT) run
@@ -109,9 +124,10 @@ lint:
109124
vet: lint
110125

111126
# Generate code
127+
# Uses GOFLAGS=-mod=mod to ignore vendor/ directory
112128
.PHONY: generate
113129
generate:
114-
go generate -x ./...
130+
GOFLAGS=-mod=mod go generate -x ./...
115131
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=cluster-baremetal-operator webhook paths=./... output:crd:artifacts:config=config/crd/bases
116132
sed -i '/^ controller-gen.kubebuilder.io\/version: (devel)/d' config/crd/bases/*
117133
$(CONTROLLER_GEN) object:headerFile=./hack/boilerplate.go.txt paths="./..."
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/spf13/cobra"
8+
extcmd "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+
// Import test packages to register Ginkgo specs
14+
_ "github.com/openshift/cluster-baremetal-operator/test/e2e/baremetal"
15+
)
16+
17+
func main() {
18+
// Extension registry
19+
registry := e.NewRegistry()
20+
21+
// Create extension
22+
ext := e.NewExtension(
23+
"openshift", // product
24+
"payload", // type
25+
"cluster-baremetal", // component name
26+
)
27+
28+
// Add suites to the extension
29+
ext.AddSuite(e.Suite{
30+
Name: "cluster-baremetal/all",
31+
Parents: []string{"openshift/conformance/parallel"},
32+
})
33+
34+
// Build test specs from Ginkgo tests automatically
35+
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
36+
if err != nil {
37+
panic(fmt.Sprintf("couldn't build extension test specs from ginkgo: %+v", err.Error()))
38+
}
39+
40+
// Apply environment selectors - baremetal platform only
41+
// All tests should only run on baremetal platform
42+
specs.Select(et.NameContains("")).
43+
Include(et.PlatformEquals("baremetal"))
44+
45+
// Add specs to extension
46+
ext.AddSpecs(specs)
47+
registry.Register(ext)
48+
49+
// Create root command
50+
rootCmd := &cobra.Command{
51+
Use: "cluster-baremetal-tests-ext",
52+
Short: "Cluster BareMetal Operator Test Extension",
53+
Long: "OpenShift Tests Extension for Cluster BareMetal Operator E2E Tests",
54+
}
55+
56+
// Register OTE subcommands (info, list, run-test, run-suite, etc.)
57+
rootCmd.AddCommand(extcmd.DefaultExtensionCommands(registry)...)
58+
59+
if err := rootCmd.Execute(); err != nil {
60+
os.Exit(1)
61+
}
62+
}

go.mod

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ module github.com/openshift/cluster-baremetal-operator
33
go 1.25.0
44

55
require (
6-
github.com/ghodss/yaml v1.0.0
6+
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
77
github.com/go-bindata/go-bindata v3.1.2+incompatible
88
github.com/golangci/golangci-lint/v2 v2.1.6
99
github.com/google/go-cmp v0.7.0
10-
github.com/metal3-io/baremetal-operator/apis v0.0.0
11-
github.com/openshift/api v0.0.0-20260318185450-1f2fa3f09f4e
12-
github.com/openshift/client-go v0.0.0-20260317180604-743f664b82d1
10+
github.com/metal3-io/baremetal-operator/apis v0.11.0-alpha.0
11+
github.com/onsi/ginkgo/v2 v2.28.1
12+
github.com/onsi/gomega v1.39.1
13+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260127124016-0fed2b824818
14+
github.com/openshift/api v0.0.0-20260327065519-582dc3d316b7
15+
github.com/openshift/client-go v0.0.0-20260330134249-7e1499aaacd7
1316
github.com/openshift/controller-runtime-common v0.0.0-20260213175913-767fef058eca
14-
github.com/openshift/library-go v0.0.0-20260213153706-03f1709971c5
17+
github.com/openshift/library-go v0.0.0-20260303171201-5d9eb6295ff6
18+
github.com/openshift/origin v1.5.0-alpha.3.0.20260403210430-c77ff4a065bf
1519
github.com/pkg/errors v0.9.1
1620
github.com/stretchr/stew v0.0.0-20130812190256-80ef0842b48b
1721
github.com/stretchr/testify v1.11.1
@@ -76,7 +80,7 @@ require (
7680
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
7781
github.com/denis-tingaikin/go-header v0.5.0 // indirect
7882
github.com/dlclark/regexp2 v1.11.5 // indirect
79-
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
83+
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
8084
github.com/ettle/strcase v0.2.0 // indirect
8185
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
8286
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
@@ -91,9 +95,9 @@ require (
9195
github.com/go-errors/errors v1.5.1 // indirect
9296
github.com/go-logr/logr v1.4.3 // indirect
9397
github.com/go-logr/zapr v1.3.0 // indirect
94-
github.com/go-openapi/jsonpointer v0.21.0 // indirect
98+
github.com/go-openapi/jsonpointer v0.21.2 // indirect
9599
github.com/go-openapi/jsonreference v0.21.0 // indirect
96-
github.com/go-openapi/swag v0.23.0 // indirect
100+
github.com/go-openapi/swag v0.23.1 // indirect
97101
github.com/go-toolsmith/astcast v1.1.0 // indirect
98102
github.com/go-toolsmith/astcopy v1.1.0 // indirect
99103
github.com/go-toolsmith/astequal v1.2.0 // indirect
@@ -152,7 +156,7 @@ require (
152156
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
153157
github.com/macabu/inamedparam v0.2.0 // indirect
154158
github.com/magiconair/properties v1.8.6 // indirect
155-
github.com/mailru/easyjson v0.7.7 // indirect
159+
github.com/mailru/easyjson v0.9.0 // indirect
156160
github.com/manuelarte/funcorder v0.2.1 // indirect
157161
github.com/maratori/testableexamples v1.0.0 // indirect
158162
github.com/maratori/testpackage v1.1.1 // indirect
@@ -182,7 +186,7 @@ require (
182186
github.com/prometheus/client_golang v1.23.2 // indirect
183187
github.com/prometheus/client_model v0.6.2 // indirect
184188
github.com/prometheus/common v0.66.1 // indirect
185-
github.com/prometheus/procfs v0.16.1 // indirect
189+
github.com/prometheus/procfs v0.17.0 // indirect
186190
github.com/quasilyte/go-ruleguard v0.4.4 // indirect
187191
github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect
188192
github.com/quasilyte/gogrep v0.5.0 // indirect
@@ -203,8 +207,8 @@ require (
203207
github.com/sonatard/noctx v0.1.0 // indirect
204208
github.com/sourcegraph/go-diff v0.7.0 // indirect
205209
github.com/spf13/afero v1.14.0 // indirect
206-
github.com/spf13/cast v1.5.0 // indirect
207-
github.com/spf13/cobra v1.9.1 // indirect
210+
github.com/spf13/cast v1.5.1 // indirect
211+
github.com/spf13/cobra v1.10.1 // indirect
208212
github.com/spf13/jwalterweatherman v1.1.0 // indirect
209213
github.com/spf13/pflag v1.0.9 // indirect
210214
github.com/spf13/viper v1.13.0 // indirect
@@ -224,7 +228,7 @@ require (
224228
github.com/uudashr/iface v1.3.1 // indirect
225229
github.com/x448/float16 v0.8.4 // indirect
226230
github.com/xen0n/gosmopolitan v1.3.0 // indirect
227-
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca // indirect
231+
github.com/xlab/treeprint v1.2.0 // indirect
228232
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
229233
github.com/yagipy/maintidx v1.0.0 // indirect
230234
github.com/yeya24/promlinter v0.3.0 // indirect
@@ -233,8 +237,8 @@ require (
233237
go-simpler.org/musttag v0.13.1 // indirect
234238
go-simpler.org/sloglint v0.11.0 // indirect
235239
go.augendre.info/fatcontext v0.8.0 // indirect
236-
go.opentelemetry.io/otel v1.35.0 // indirect
237-
go.opentelemetry.io/otel/trace v1.35.0 // indirect
240+
go.opentelemetry.io/otel v1.37.0 // indirect
241+
go.opentelemetry.io/otel/trace v1.37.0 // indirect
238242
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
239243
go.uber.org/automaxprocs v1.6.0 // indirect
240244
go.uber.org/multierr v1.11.0 // indirect
@@ -249,7 +253,7 @@ require (
249253
golang.org/x/sys v0.40.0 // indirect
250254
golang.org/x/term v0.39.0 // indirect
251255
golang.org/x/text v0.33.0 // indirect
252-
golang.org/x/time v0.11.0 // indirect
256+
golang.org/x/time v0.12.0 // indirect
253257
golang.org/x/tools v0.41.0 // indirect
254258
golang.org/x/tools/go/expect v0.1.1-deprecated // indirect
255259
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
@@ -260,18 +264,18 @@ require (
260264
gopkg.in/yaml.v2 v2.4.0 // indirect
261265
gopkg.in/yaml.v3 v3.0.1 // indirect
262266
honnef.co/go/tools v0.6.1 // indirect
263-
k8s.io/apiextensions-apiserver v0.34.3 // indirect
264-
k8s.io/apiserver v0.34.3 // indirect
265-
k8s.io/component-base v0.34.3 // indirect
266-
k8s.io/kube-aggregator v0.34.1 // indirect
267+
k8s.io/apiextensions-apiserver v0.35.1 // indirect
268+
k8s.io/apiserver v0.35.1 // indirect
269+
k8s.io/component-base v0.35.1 // indirect
270+
k8s.io/kube-aggregator v0.35.1 // indirect
267271
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
268272
mvdan.cc/gofumpt v0.8.0 // indirect
269273
mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4 // indirect
270274
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
271275
sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96 // indirect
272-
sigs.k8s.io/kustomize/api v0.11.4 // indirect
276+
sigs.k8s.io/kustomize/api v0.20.1 // indirect
273277
sigs.k8s.io/kustomize/cmd/config v0.10.6 // indirect
274-
sigs.k8s.io/kustomize/kyaml v0.13.6 // indirect
278+
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
275279
sigs.k8s.io/randfill v1.0.0 // indirect
276280
sigs.k8s.io/structured-merge-diff/v6 v6.3.2-0.20260122202528-d9cc6641c482 // indirect
277281
)
@@ -281,3 +285,5 @@ replace github.com/metal3-io/baremetal-operator => github.com/openshift/baremeta
281285
replace github.com/metal3-io/baremetal-operator/apis => github.com/openshift/baremetal-operator/apis v0.0.0-20250318213501-20a31adf14bc
282286

283287
replace github.com/metal3-io/baremetal-operator/pkg/hardwareutils => github.com/openshift/baremetal-operator/pkg/hardwareutils v0.0.0-20250318213501-20a31adf14bc
288+
289+
replace github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20260303184444-1cc650aa0565

0 commit comments

Comments
 (0)