Skip to content

Commit ef3173e

Browse files
committed
set up openshift-tests-extension and add a sanity test
1 parent 2d60b68 commit ef3173e

File tree

297 files changed

+199401
-6
lines changed

Some content is hidden

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

297 files changed

+199401
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/cluster-kube-apiserver-operator
2+
/kube-apiserver-tests-ext
23
.idea/
34
/_output/
45
telepresence.log
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"name": "[Jira:KAS][sig-api-machinery] sanity test should always pass [Suite:openshift/cluster-kube-apiserver-operator/conformance/parallel]",
4+
"labels": {},
5+
"resources": {
6+
"isolation": {}
7+
},
8+
"source": "openshift:payload:cluster-kube-apiserver-operator",
9+
"lifecycle": "blocking",
10+
"environmentSelector": {}
11+
}
12+
]

Dockerfile.rhel7

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

79
FROM registry.ci.openshift.org/ocp/4.20:base-rhel9
810
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/bindata/bootkube/bootstrap-manifests /usr/share/bootkube/manifests/bootstrap-manifests/
@@ -11,6 +13,8 @@ COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator
1113
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/bindata/bootkube/scc-manifests /usr/share/bootkube/manifests/manifests/
1214
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/vendor/github.com/openshift/api/apiserver/v1/zz_generated.crd-manifests/kube-apiserver_apirequestcounts.crd.yaml /usr/share/bootkube/manifests/manifests/
1315
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/cluster-kube-apiserver-operator /usr/bin/
16+
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/kube-apiserver-tests-ext.gz /usr/bin/cluster-kube-apiserver-operator-tests-ext.gz
17+
1418
COPY manifests /manifests
1519
COPY bindata/bootkube/scc-manifests /manifests
1620
LABEL io.openshift.release.operator true

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ IMAGE_REGISTRY :=registry.svc.ci.openshift.org
1717
ENCRYPTION_PROVIDERS=aescbc aesgcm
1818
ENCRYPTION_PROVIDER?=aescbc
1919

20+
TESTS_EXT_BINARY := kube-apiserver-tests-ext
21+
TESTS_EXT_PACKAGE := ./cmd/kube-apiserver-tests-ext
22+
23+
TESTS_EXT_GIT_COMMIT := $(shell git rev-parse --short HEAD)
24+
TESTS_EXT_BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
25+
TESTS_EXT_GIT_TREE_STATE := $(shell if git diff --quiet; then echo clean; else echo dirty; fi)
26+
27+
TESTS_EXT_LDFLAGS := -X 'github.com/openshift-eng/openshift-tests-extension/pkg/version.CommitFromGit=$(TESTS_EXT_GIT_COMMIT)' \
28+
-X 'github.com/openshift-eng/openshift-tests-extension/pkg/version.BuildDate=$(TESTS_EXT_BUILD_DATE)' \
29+
-X 'github.com/openshift-eng/openshift-tests-extension/pkg/version.GitTreeState=$(TESTS_EXT_GIT_TREE_STATE)'
30+
2031
# This will call a macro called "build-image" which will generate image specific targets based on the parameters:
2132
# $0 - macro name
2233
# $1 - target name
@@ -85,6 +96,36 @@ test-e2e-sno-disruptive: GO_TEST_FLAGS += -p 1
8596
test-e2e-sno-disruptive: test-unit
8697
.PHONY: test-e2e-sno-disruptive
8798

99+
# -------------------------------------------------------------------
100+
# Build binary with metadata (CI-compliant)
101+
# -------------------------------------------------------------------
102+
.PHONY: tests-ext-build
103+
tests-ext-build:
104+
GOOS=$(GOOS) GOARCH=$(GOARCH) GO_COMPLIANCE_POLICY=exempt_all CGO_ENABLED=0 \
105+
go build -o $(TESTS_EXT_BINARY) -ldflags "$(TESTS_EXT_LDFLAGS)" $(TESTS_EXT_PACKAGE)
106+
107+
# -------------------------------------------------------------------
108+
# Run "update" and strip env-specific metadata
109+
# -------------------------------------------------------------------
110+
.PHONY: tests-ext-update
111+
tests-ext-update: tests-ext-build
112+
./$(TESTS_EXT_BINARY) update
113+
for f in .openshift-tests-extension/*.json; do \
114+
jq 'map(del(.codeLocations))' "$$f" > tmpp && mv tmpp "$$f"; \
115+
done
116+
117+
# -------------------------------------------------------------------
118+
# Run go test on ./test/extended/... with proper flags
119+
# -------------------------------------------------------------------
120+
.PHONY: test-extended
121+
test-extended: GO_TEST_PACKAGES := ./test/extended/...
122+
test-extended: GO_TEST_FLAGS += -v
123+
test-extended: GO_TEST_FLAGS += -timeout 3h
124+
test-extended: GO_TEST_FLAGS += -p 1
125+
test-extended: test-unit
126+
test-extended:
127+
GO111MODULE=on go test $(GO_TEST_FLAGS) $(GO_TEST_PACKAGES)
128+
88129
clean:
89130
$(RM) ./cluster-kube-apiserver-operator
90131
.PHONY: clean
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
8+
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
9+
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
10+
11+
"github.com/spf13/cobra"
12+
13+
// Register Ginkgo tests
14+
_ "github.com/openshift/cluster-kube-apiserver-operator/test/extended"
15+
)
16+
17+
func main() {
18+
registry := e.NewRegistry()
19+
20+
ext := e.NewExtension("openshift", "payload", "cluster-kube-apiserver-operator")
21+
22+
ext.AddSuite(e.Suite{
23+
Name: "openshift/cluster-kube-apiserver-operator/conformance/parallel",
24+
Parents: []string{
25+
"openshift/conformance/parallel",
26+
},
27+
Qualifiers: []string{
28+
"name.contains('[Suite:openshift/cluster-kube-apiserver-operator/conformance/parallel]')",
29+
},
30+
})
31+
32+
specs, err := g.BuildExtensionTestSpecsFromOpenShiftGinkgoSuite()
33+
if err != nil {
34+
panic(fmt.Sprintf("could not build extension test specs from ginkgo: %+v", err))
35+
}
36+
37+
ext.AddSpecs(specs)
38+
registry.Register(ext)
39+
40+
root := &cobra.Command{
41+
Long: "OpenShift Tests Extension for Cluster Kube Apiserver Operator",
42+
}
43+
root.AddCommand(cmd.DefaultExtensionCommands(registry)...)
44+
45+
if err := root.Execute(); err != nil {
46+
os.Exit(1)
47+
}
48+
}

go.mod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ require (
1212
github.com/google/go-cmp v0.7.0
1313
github.com/imdario/mergo v0.3.8
1414
github.com/miekg/dns v1.1.61
15+
github.com/onsi/ginkgo/v2 v2.22.0
16+
github.com/onsi/gomega v1.36.1
17+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250804142706-7b3ab438a292
1518
github.com/openshift/api v0.0.0-20250710004639-926605d3338b
1619
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee
1720
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee
@@ -54,6 +57,7 @@ require (
5457
github.com/go-openapi/jsonpointer v0.21.0 // indirect
5558
github.com/go-openapi/jsonreference v0.20.2 // indirect
5659
github.com/go-openapi/swag v0.23.0 // indirect
60+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
5761
github.com/gogo/protobuf v1.3.2 // indirect
5862
github.com/golang/protobuf v1.5.4 // indirect
5963
github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac // indirect
@@ -127,3 +131,5 @@ require (
127131
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
128132
sigs.k8s.io/yaml v1.4.0 // indirect
129133
)
134+
135+
replace github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12

go.sum

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En
6767
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
6868
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
6969
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
70-
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
7170
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
7271
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
7372
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
@@ -156,10 +155,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
156155
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
157156
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
158157
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
159-
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
160-
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
161-
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
162-
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
158+
github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw=
159+
github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
160+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250804142706-7b3ab438a292 h1:3athg6KQ+TaNfW4BWZDlGFt1ImSZEJWgzXtPC1VPITI=
161+
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250804142706-7b3ab438a292/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
163162
github.com/openshift/api v0.0.0-20250710004639-926605d3338b h1:A8OY6adT2aZNp7tsGsilHuQ3RqhzrFx5dzGr/UwXfJg=
164163
github.com/openshift/api v0.0.0-20250710004639-926605d3338b/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
165164
github.com/openshift/build-machinery-go v0.0.0-20250530140348-dc5b2804eeee h1:+Sp5GGnjHDhT/a/nQ1xdp43UscBMr7G5wxsYotyhzJ4=
@@ -168,6 +167,8 @@ github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee h1:tOtrrxfDEW8
168167
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee/go.mod h1:zhRiYyNMk89llof2qEuGPWPD+joQPhCRUc2IK0SB510=
169168
github.com/openshift/library-go v0.0.0-20250729191057-91376e1b394e h1:xYT+P++PSc9G+Y47pIcU9fm8IDV/tg6tMi3i+0m23pU=
170169
github.com/openshift/library-go v0.0.0-20250729191057-91376e1b394e/go.mod h1:tptKNust9MdRI0p90DoBSPHIrBa9oh+Rok59tF0vT8c=
170+
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12 h1:AKx/w1qpS8We43bsRgf8Nll3CGlDHpr/WAXvuedTNZI=
171+
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
171172
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
172173
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
173174
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

test/extended/main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package extended
2+
3+
import (
4+
g "github.com/onsi/ginkgo/v2"
5+
o "github.com/onsi/gomega"
6+
)
7+
8+
var _ = g.Describe("[Jira:KAS][sig-api-machinery] sanity test", func() {
9+
g.It("should always pass [Suite:openshift/cluster-kube-apiserver-operator/conformance/parallel]", func() {
10+
o.Expect(true).To(o.BeTrue())
11+
})
12+
})

vendor/github.com/go-task/slim-sprig/v3/.editorconfig

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/go-task/slim-sprig/v3/.gitattributes

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)