Skip to content

Commit 5893e18

Browse files
UPSTREAM: <carry>: Add structure to allow move the orgin tests using OTE
This commit add the binary and creates the structure to allow using OTE to run olmv1 OCP origin tests.
1 parent bd1cea0 commit 5893e18

File tree

7 files changed

+268
-0
lines changed

7 files changed

+268
-0
lines changed

openshift/tests-extension/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/*

openshift/tests-extension/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.23-openshift-4.20 AS builder
2+
3+
WORKDIR /go/src/github/operator-framework-operator-controller/openshift/tests-extension
4+
5+
COPY . .
6+
7+
RUN make build && \
8+
mkdir -p /tmp/build && \
9+
cp ./bin/tests-extension /tmp/build/tests-extension && \
10+
gzip -f /tmp/build/tests-extension
11+
12+
FROM registry.ci.openshift.org/ocp/4.20:tools
13+
COPY --from=builder /tmp/build/tests-extension.gz /usr/bin/tests-extension.gz
14+
RUN gunzip /usr/bin/extended-tests.gz && chmod +x /usr/bin/extended-tests
15+
16+
LABEL io.k8s.display-name="OpenShift Tests Extension" \
17+
io.openshift.release.operator=true \
18+
io.openshift.tags="openshift,tests,e2e,e2e-extension"
19+
20+
ENTRYPOINT ["/usr/bin/tests-extension"]

openshift/tests-extension/Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Get the directory where this Makefile is, so we can use it below for including
2+
# Include the same Bingo variables used by the project
3+
DIR := $(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
4+
include $(DIR)/../../.bingo/Variables.mk
5+
6+
# Definitions for the extended tests
7+
8+
GO_PKG_NAME := github/operator-framework-operator-controller/openshift/extended-tests
9+
10+
GIT_COMMIT := $(shell git rev-parse --short HEAD)
11+
BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
12+
GIT_TREE_STATE := $(shell if git diff --quiet; then echo clean; else echo dirty; fi)
13+
14+
LDFLAGS := -X '$(GO_PKG_NAME)/pkg/version.CommitFromGit=$(GIT_COMMIT)' \
15+
-X '$(GO_PKG_NAME)/pkg/version.BuildDate=$(BUILD_DATE)' \
16+
-X '$(GO_PKG_NAME)/pkg/version.GitTreeState=$(GIT_TREE_STATE)'
17+
18+
#SECTION General
19+
20+
# The help target prints out all targets with their descriptions organized
21+
# beneath their categories. The categories are represented by '#SECTION' and the
22+
# target descriptions by '#HELP' or '#EXHELP'. The awk commands is responsible for reading the
23+
# entire set of makefiles included in this invocation, looking for lines of the
24+
# file as xyz: #HELP something, and then pretty-format the target and help. Then,
25+
# if there's a line with #SECTION something, that gets pretty-printed as a category.
26+
# More info on the usage of ANSI control characters for terminal formatting:
27+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
28+
# More info on the awk command:
29+
# http://linuxcommand.org/lc3_adv_awk.php
30+
# The extended-help target uses '#EXHELP' as the delineator.
31+
32+
.PHONY: help
33+
help: #HELP Display essential help.
34+
@awk 'BEGIN {FS = ":[^#]*#HELP"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\n"} /^[a-zA-Z_0-9-]+:.*#HELP / { printf " \033[36m%-17s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST)
35+
36+
#SECTION Tests
37+
TOOLS_BIN_DIR := $(CURDIR)/bin
38+
39+
#SECTION Development
40+
.PHONY: verify #HELP To verify the code
41+
verify: tidy fmt vet lint
42+
43+
.PHONY: tidy #HELP Run go mod tidy.
44+
tidy:
45+
go mod tidy
46+
47+
.PHONY: fmt
48+
fmt: #HELP Run go fmt against code.
49+
go fmt ./...
50+
51+
.PHONY: vet
52+
vet: #HELP Run go vet against code.
53+
go vet ./...
54+
55+
.PHONY: lint
56+
lint: $(GOLANGCI_LINT) #HELP Run golangci linter.
57+
$(GOLANGCI_LINT) run
58+
59+
.PHONY: fix-lint
60+
fix-lint: $(GOLANGCI_LINT) #HELP Fix lint issues
61+
$(GOLANGCI_LINT) run --fix
62+
63+
.PHONY: build
64+
build: #HELP Build the extended tests binary
65+
# GO_COMPLIANCE_POLICY="exempt_all" must only be used for test related binaries.
66+
# It prevents various FIPS compliance policies from being applied to this compilation.
67+
# Do not set globally.
68+
@mkdir -p $(TOOLS_BIN_DIR)
69+
GO_COMPLIANCE_POLICY="exempt_all" go build -ldflags "$(LDFLAGS)" -o $(TOOLS_BIN_DIR)/tests-extension ./cmd/...

openshift/tests-extension/cmd/main.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
This command is used to run the OLMv1 tests extension for OpenShift.
3+
It registers the OLMv1 tests with the OpenShift Tests Extension framework
4+
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+
15+
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
16+
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
17+
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
18+
"github.com/spf13/cobra"
19+
20+
// The import below is necessary to ensure that the OLMv1 tests are registered with the extension.
21+
_ "github/operator-framework-operator-controller/openshift/tests-extension/test"
22+
)
23+
24+
func main() {
25+
registry := e.NewRegistry()
26+
ext := e.NewExtension("operator-framework", "payload", "olmv1-tests-extension")
27+
28+
// Add suites to the extension. Specifying parents will cause the tests from this suite
29+
// to be included when a parent is invoked.
30+
// This suite can be executed by running the following command:
31+
// - $ make build
32+
// - $ ./bin/tests-extension run-suite olmv1/tests
33+
ext.AddSuite(e.Suite{
34+
Name: "olmv1/tests",
35+
Parents: []string{"openshift/conformance/parallel"},
36+
})
37+
38+
specs, 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+
ext.AddSpecs(specs)
44+
registry.Register(ext)
45+
46+
root := &cobra.Command{
47+
Long: "OLMv1 Tests Extension",
48+
}
49+
50+
root.AddCommand(cmd.DefaultExtensionCommands(registry)...)
51+
52+
if err := func() error {
53+
return root.Execute()
54+
}(); err != nil {
55+
os.Exit(1)
56+
}
57+
}

openshift/tests-extension/go.mod

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
module github/operator-framework-operator-controller/openshift/tests-extension
2+
3+
go 1.23.6
4+
5+
require (
6+
github.com/onsi/ginkgo/v2 v2.21.0
7+
github.com/onsi/gomega v1.35.1
8+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250522124649-4ffcd156ec7c
9+
github.com/spf13/cobra v1.8.1
10+
)
11+
12+
require (
13+
cel.dev/expr v0.18.0 // indirect
14+
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
15+
github.com/go-logr/logr v1.4.2 // indirect
16+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
17+
github.com/google/cel-go v0.17.8 // indirect
18+
github.com/google/go-cmp v0.6.0 // indirect
19+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
20+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
21+
github.com/pkg/errors v0.9.1 // indirect
22+
github.com/spf13/pflag v1.0.5 // indirect
23+
github.com/stoewer/go-strcase v1.2.0 // indirect
24+
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
25+
golang.org/x/net v0.30.0 // indirect
26+
golang.org/x/sys v0.26.0 // indirect
27+
golang.org/x/text v0.19.0 // indirect
28+
golang.org/x/tools v0.26.0 // indirect
29+
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect
30+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 // indirect
31+
google.golang.org/protobuf v1.35.1 // indirect
32+
gopkg.in/yaml.v3 v3.0.1 // indirect
33+
)
34+
35+
// cel-go v0.23.0 upgrade causes errors raised from the vendor source which lead to think in
36+
// incompatibilities scenarios. After upgrade to use the latest versions of k8s/api v0.33+
37+
// we should try to see if we could fix this one and remove this replace
38+
replace github.com/google/cel-go => github.com/google/cel-go v0.22.1
39+
40+
replace k8s.io/api => k8s.io/api v0.32.3
41+
42+
replace github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12

openshift/tests-extension/go.sum

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
cel.dev/expr v0.18.0 h1:CJ6drgk+Hf96lkLikr4rFf19WrU0BOWEihyZnI2TAzo=
2+
cel.dev/expr v0.18.0/go.mod h1:MrpN08Q+lEBs+bGYdLxxHkZoUSsCp0nSKTs0nTymJgw=
3+
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
4+
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
5+
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
6+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
8+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9+
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
10+
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
11+
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
12+
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
13+
github.com/google/cel-go v0.22.1 h1:AfVXx3chM2qwoSbM7Da8g8hX8OVSkBFwX+rz2+PcK40=
14+
github.com/google/cel-go v0.22.1/go.mod h1:BuznPXXfQDpXKWQ9sPW3TzlAJN5zzFe+i9tIs0yC4s8=
15+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
16+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
17+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
18+
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
19+
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
20+
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
21+
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
22+
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
23+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250522124649-4ffcd156ec7c h1:R5dI2oOF2RtS1sKtLrhW9KMg0ydzF0XM2Q//ma55nWI=
24+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250522124649-4ffcd156ec7c/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
25+
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12 h1:AKx/w1qpS8We43bsRgf8Nll3CGlDHpr/WAXvuedTNZI=
26+
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
27+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
28+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
29+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
30+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
31+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
32+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
33+
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
34+
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
35+
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
36+
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
37+
github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU=
38+
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
39+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
40+
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
41+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
42+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
43+
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU=
44+
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
45+
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
46+
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
47+
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
48+
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
49+
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
50+
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
51+
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
52+
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
53+
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 h1:YcyjlL1PRr2Q17/I0dPk2JmYS5CDXfcdb2Z3YRioEbw=
54+
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo=
55+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61 h1:N9BgCIAUvn/M+p4NJccWPWb3BWh88+zyL0ll9HgbEeM=
56+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240924160255-9d4c2d233b61/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
57+
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
58+
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
59+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
60+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
61+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
62+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
63+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package test
2+
3+
import (
4+
"context"
5+
6+
//nolint:stylecheck
7+
. "github.com/onsi/ginkgo/v2"
8+
//nolint:stylecheck
9+
. "github.com/onsi/gomega"
10+
)
11+
12+
var _ = Describe("[sig-operator] OLMv1", func() {
13+
It("should pass a trivial sanity check", func(ctx context.Context) {
14+
Expect(len("test")).To(BeNumerically(">", 0))
15+
})
16+
})

0 commit comments

Comments
 (0)