Skip to content

Commit 5cdc92c

Browse files
committed
chore: port the test suite over from openshift-tests-private
1 parent 4496a0a commit 5cdc92c

File tree

1,891 files changed

+382569
-17
lines changed

Some content is hidden

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

1,891 files changed

+382569
-17
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,11 @@ This targets needs `docker` to be installed on host and was not tested with othe
114114

115115
Assuming that the `KUBECONFIG` environment variable is set to the config file of an OpenShift cluster against which the tests will run, you can execute all the tests running `make test`.
116116

117-
Testing entails 3 types of tests:
117+
Testing entails 4 types of tests:
118118
- Unit tests which can be run separately with `make test-unit`.
119119
- Prometheus rule tests which can be run separately with `make test-rules`.
120120
- End-to-end tests which can be run separately with `make test-e2e`.
121+
- Ginkgo tests that were ported from openshift-tests-private, which can be run separately with `make test-ginkgo`. **Please do not add new tests here. The goal is to merge Ginkgo tests into the E2E suite to get a single, unified testing framework.**
121122

122123
If you need to run a specific unit test (for example `TestHashSecret`), you can use the following command:
123124

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ GOPROXY?=http://proxy.golang.org
1212
export GO111MODULE
1313
export GOPROXY
1414

15-
# go pakages for unit tests, excluding e2e tests
16-
PKGS=$(shell go list ./... | grep -v /test/e2e)
15+
# go pakages for unit tests, excluding e2e and ex-openshift-private tests
16+
PKGS=$(shell go list ./... | grep -vE '/test/(e2e|monitoring)')
1717
GOLANG_FILES:=$(shell find . -name \*.go -print)
1818
# NOTE: grep -v %.yaml is needed because "%s-policy.yaml" is used
1919
# in manifest.go and that isn't a valid asset.
@@ -29,8 +29,8 @@ BIN_DIR ?= $(shell pwd)/tmp/bin
2929

3030
# Docgen related variables
3131
TYPES_TARGET=pkg/manifests/types.go
32-
K8S_VERSION=$(shell echo -n v1. && cat go.mod | grep -w "k8s.io/api" | awk '{ print $$2 }' | cut -d "." -f 2)
33-
PO_VERSION=$(shell cat go.mod | grep "github.com/prometheus-operator/prometheus-operator[^=>]\+$$" | awk '{ print $$2 }' | sort -u)
32+
K8S_VERSION=$(shell go list -m -json k8s.io/api | jq -r '.Version | split(".")[1] | "v1." + .')
33+
PO_VERSION=$(shell go list -m -json github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring | jq -r ".Version")
3434

3535
EMBEDMD_BIN=$(BIN_DIR)/embedmd
3636
JB_BIN=$(BIN_DIR)/jb
@@ -270,7 +270,7 @@ check-runbooks:
270270
###########
271271

272272
.PHONY: test
273-
test: test-unit test-rules test-e2e
273+
test: test-unit test-rules test-e2e test-ginkgo
274274

275275
.PHONY: test-unit
276276
test-unit:
@@ -281,6 +281,11 @@ test-e2e: KUBECONFIG?=$(HOME)/.kube/config
281281
test-e2e:
282282
go test -v -timeout=150m ./test/e2e/ --kubeconfig $(KUBECONFIG)
283283

284+
.PHONY: test-ginkgo
285+
test-ginkgo: KUBECONFIG?=$(HOME)/.kube/config
286+
test-ginkgo:
287+
KUBECONFIG=$(KUBECONFIG) go test -v -timeout=150m ./test/monitoring/
288+
284289
$(BIN_DIR):
285290
mkdir -p $(BIN_DIR)
286291

cmd/tests-ext/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
func main() {
1818
registry := e.NewRegistry()
1919

20+
// Tests should only be run as part of or via openshift-tests, running tests via the extension is not supported.
2021
ext := e.NewExtension("openshift", "payload", "cluster-monitoring-operator")
2122
ext.AddSuite(e.Suite{
2223
Name: "openshift/cluster-monitoring-operator/conformance/parallel",

go.mod

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ require (
2121
github.com/openshift/api v0.0.0-20250320170726-75d64d71980b
2222
github.com/openshift/client-go v0.0.0-20250125113824-8e1f0b8fa9a7
2323
github.com/openshift/library-go v0.0.0-20250402180609-ce2ba53fb2a4
24+
github.com/pborman/uuid v1.2.1
2425
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.81.0
2526
github.com/prometheus-operator/prometheus-operator/pkg/client v0.81.0
2627
github.com/prometheus/alertmanager v0.27.0
@@ -29,6 +30,7 @@ require (
2930
github.com/prometheus/prometheus v0.54.1
3031
github.com/spf13/cobra v1.8.1
3132
github.com/stretchr/testify v1.9.0
33+
github.com/tidwall/gjson v1.18.0
3234
golang.org/x/net v0.34.0
3335
golang.org/x/sync v0.10.0
3436
golang.org/x/text v0.21.0
@@ -43,6 +45,7 @@ require (
4345
k8s.io/component-base v0.32.2
4446
k8s.io/klog/v2 v2.130.1
4547
k8s.io/kube-aggregator v0.32.1
48+
k8s.io/kubernetes v1.32.1
4649
k8s.io/metrics v0.31.1
4750
k8s.io/utils v0.0.0-20241210054802-24370beab758
4851
sigs.k8s.io/controller-runtime v0.20.3
@@ -56,18 +59,28 @@ require (
5659
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 // indirect
5760
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
5861
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
62+
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab // indirect
63+
github.com/Microsoft/go-winio v0.6.2 // indirect
5964
github.com/NYTimes/gziphandler v1.1.1 // indirect
6065
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
6166
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
6267
github.com/aws/aws-sdk-go v1.54.19 // indirect
6368
github.com/beorn7/perks v1.0.1 // indirect
6469
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
6570
github.com/cespare/xxhash/v2 v2.3.0 // indirect
71+
github.com/containerd/containerd/api v1.7.19 // indirect
72+
github.com/containerd/errdefs v0.1.0 // indirect
73+
github.com/containerd/log v0.1.0 // indirect
74+
github.com/containerd/ttrpc v1.2.5 // indirect
6675
github.com/coreos/go-semver v0.3.1 // indirect
6776
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
77+
github.com/cyphar/filepath-securejoin v0.3.4 // indirect
6878
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
6979
github.com/dennwc/varint v1.0.0 // indirect
80+
github.com/distribution/reference v0.6.0 // indirect
81+
github.com/docker/go-units v0.5.0 // indirect
7082
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
83+
github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect
7184
github.com/felixge/httpsnoop v1.0.4 // indirect
7285
github.com/fsnotify/fsnotify v1.7.0 // indirect
7386
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
@@ -83,15 +96,18 @@ require (
8396
github.com/go-openapi/swag v0.23.0 // indirect
8497
github.com/go-openapi/validate v0.23.0 // indirect
8598
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
99+
github.com/godbus/dbus/v5 v5.1.0 // indirect
86100
github.com/gogo/protobuf v1.3.2 // indirect
87101
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
88102
github.com/golang/protobuf v1.5.4 // indirect
89103
github.com/google/btree v1.1.3 // indirect
104+
github.com/google/cadvisor v0.51.0 // indirect
90105
github.com/google/cel-go v0.22.0 // indirect
91106
github.com/google/gnostic-models v0.6.9 // indirect
92107
github.com/google/go-cmp v0.6.0 // indirect
93108
github.com/google/gofuzz v1.2.0 // indirect
94109
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
110+
github.com/gorilla/websocket v1.5.0 // indirect
95111
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc // indirect
96112
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
97113
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
@@ -100,24 +116,37 @@ require (
100116
github.com/josharian/intern v1.0.0 // indirect
101117
github.com/jpillora/backoff v1.0.0 // indirect
102118
github.com/json-iterator/go v1.1.12 // indirect
119+
github.com/karrick/godirwalk v1.17.0 // indirect
103120
github.com/klauspost/compress v1.17.10 // indirect
104121
github.com/kylelemons/godebug v1.1.0 // indirect
105122
github.com/mailru/easyjson v0.9.0 // indirect
123+
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect
106124
github.com/mitchellh/mapstructure v1.5.0 // indirect
125+
github.com/moby/spdystream v0.5.0 // indirect
126+
github.com/moby/sys/mountinfo v0.7.2 // indirect
127+
github.com/moby/sys/userns v0.1.0 // indirect
107128
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
108129
github.com/modern-go/reflect2 v1.0.2 // indirect
109130
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
110131
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
132+
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
111133
github.com/oklog/ulid v1.3.1 // indirect
134+
github.com/opencontainers/go-digest v1.0.0 // indirect
135+
github.com/opencontainers/runc v1.2.1 // indirect
136+
github.com/opencontainers/runtime-spec v1.2.0 // indirect
137+
github.com/opencontainers/selinux v1.11.1 // indirect
112138
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
113139
github.com/pkg/errors v0.9.1 // indirect
114140
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
115141
github.com/prometheus/client_model v0.6.1 // indirect
116142
github.com/prometheus/common/sigv4 v0.1.0 // indirect
117143
github.com/prometheus/procfs v0.15.1 // indirect
118144
github.com/robfig/cron v1.2.0 // indirect
145+
github.com/sirupsen/logrus v1.9.3 // indirect
119146
github.com/spf13/pflag v1.0.5 // indirect
120147
github.com/stoewer/go-strcase v1.3.0 // indirect
148+
github.com/tidwall/match v1.1.1 // indirect
149+
github.com/tidwall/pretty v1.2.0 // indirect
121150
github.com/x448/float16 v0.8.4 // indirect
122151
go.etcd.io/etcd/api/v3 v3.5.16 // indirect
123152
go.etcd.io/etcd/client/pkg/v3 v3.5.16 // indirect
@@ -151,12 +180,40 @@ require (
151180
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
152181
gopkg.in/inf.v0 v0.9.1 // indirect
153182
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
183+
k8s.io/cloud-provider v0.0.0 // indirect
184+
k8s.io/component-helpers v0.32.1 // indirect
185+
k8s.io/controller-manager v0.32.1 // indirect
186+
k8s.io/cri-api v0.0.0 // indirect
187+
k8s.io/cri-client v0.0.0 // indirect
188+
k8s.io/csi-translation-lib v0.0.0 // indirect
189+
k8s.io/dynamic-resource-allocation v0.0.0 // indirect
154190
k8s.io/kms v0.32.2 // indirect
155191
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
192+
k8s.io/kube-scheduler v0.0.0 // indirect
193+
k8s.io/kubectl v0.0.0 // indirect
194+
k8s.io/kubelet v0.0.0 // indirect
195+
k8s.io/mount-utils v0.0.0 // indirect
196+
k8s.io/pod-security-admission v0.0.0 // indirect
156197
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 // indirect
157198
sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96 // indirect
158199
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
159200
)
160201

161202
// Some utils are only available in the fork https://github.com/openshift-eng/openshift-tests-extension/blob/8ef37c67e666954f9b95e52320c9c20d6b53d241/go.mod#L37
162203
replace github.com/onsi/ginkgo/v2 => github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20241205171354-8006f302fd12
204+
205+
replace (
206+
k8s.io/api => github.com/openshift/kubernetes/staging/src/k8s.io/api v0.0.0-20250704150419-38c60a516ecb
207+
k8s.io/cloud-provider => github.com/openshift/kubernetes/staging/src/k8s.io/cloud-provider v0.0.0-20250704150419-38c60a516ecb
208+
k8s.io/controller-manager => github.com/openshift/kubernetes/staging/src/k8s.io/controller-manager v0.0.0-20250704150419-38c60a516ecb
209+
k8s.io/cri-api => github.com/openshift/kubernetes/staging/src/k8s.io/cri-api v0.0.0-20250704150419-38c60a516ecb
210+
k8s.io/cri-client => github.com/openshift/kubernetes/staging/src/k8s.io/cri-client v0.0.0-20250704150419-38c60a516ecb
211+
k8s.io/csi-translation-lib => github.com/openshift/kubernetes/staging/src/k8s.io/csi-translation-lib v0.0.0-20250704150419-38c60a516ecb
212+
k8s.io/dynamic-resource-allocation => github.com/openshift/kubernetes/staging/src/k8s.io/dynamic-resource-allocation v0.0.0-20250704150419-38c60a516ecb
213+
k8s.io/kube-scheduler => github.com/openshift/kubernetes/staging/src/k8s.io/kube-scheduler v0.0.0-20250704150419-38c60a516ecb
214+
k8s.io/kubectl => github.com/openshift/kubernetes/staging/src/k8s.io/kubectl v0.0.0-20250704150419-38c60a516ecb
215+
k8s.io/kubelet => github.com/openshift/kubernetes/staging/src/k8s.io/kubelet v0.0.0-20250704150419-38c60a516ecb
216+
k8s.io/kubernetes => github.com/openshift/kubernetes v1.30.1-0.20250704150419-38c60a516ecb
217+
k8s.io/mount-utils => github.com/openshift/kubernetes/staging/src/k8s.io/mount-utils v0.0.0-20250704150419-38c60a516ecb
218+
k8s.io/pod-security-admission => github.com/openshift/kubernetes/staging/src/k8s.io/pod-security-admission v0.0.0-20250704150419-38c60a516ecb
219+
)

0 commit comments

Comments
 (0)