Skip to content

Commit 515db30

Browse files
UPSTREAM: <carry>: [OTE] add webhook tests
Migrates OLMv1 webhook operator tests from using external YAML files to defining resources in Go structs. This change removes file dependencies, improving test reliability and simplifying test setup. The migration is a refactoring of code from openshift/origin#30059. The new code uses better naming conventions and adapts the tests to work with a controller-runtime client, enhancing test consistency and maintainability. The migration covers all core test scenarios: - Validating, mutating, and conversion webhooks. - Certificate and secret rotation tolerance. Assisted-by: Gemini
1 parent 1b06fc6 commit 515db30

File tree

229 files changed

+10362
-4763
lines changed

Some content is hidden

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

229 files changed

+10362
-4763
lines changed

openshift/tests-extension/.openshift-tests-extension/openshift_payload_olmv1.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,55 @@
1818
"source": "openshift:payload:olmv1",
1919
"lifecycle": "blocking",
2020
"environmentSelector": {}
21+
},
22+
{
23+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMWebhookProviderOpenshiftServiceCA][Serial] Webhook Operator should have a working validating webhook",
24+
"labels": {},
25+
"resources": {
26+
"isolation": {}
27+
},
28+
"source": "openshift:payload:olmv1",
29+
"lifecycle": "blocking",
30+
"environmentSelector": {}
31+
},
32+
{
33+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMWebhookProviderOpenshiftServiceCA][Serial] Webhook Operator should have a working mutating webhook",
34+
"labels": {},
35+
"resources": {
36+
"isolation": {}
37+
},
38+
"source": "openshift:payload:olmv1",
39+
"lifecycle": "blocking",
40+
"environmentSelector": {}
41+
},
42+
{
43+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMWebhookProviderOpenshiftServiceCA][Serial] Webhook Operator should have a working conversion webhook",
44+
"labels": {},
45+
"resources": {
46+
"isolation": {}
47+
},
48+
"source": "openshift:payload:olmv1",
49+
"lifecycle": "blocking",
50+
"environmentSelector": {}
51+
},
52+
{
53+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMWebhookProviderOpenshiftServiceCA][Serial] Webhook Operator should be tolerant to openshift-service-ca certificate rotation",
54+
"labels": {},
55+
"resources": {
56+
"isolation": {}
57+
},
58+
"source": "openshift:payload:olmv1",
59+
"lifecycle": "blocking",
60+
"environmentSelector": {}
61+
},
62+
{
63+
"name": "[sig-olmv1][OCPFeatureGate:NewOLMWebhookProviderOpenshiftServiceCA][Serial] Webhook Operator should be tolerant to tls secret deletion",
64+
"labels": {},
65+
"resources": {
66+
"isolation": {}
67+
},
68+
"source": "openshift:payload:olmv1",
69+
"lifecycle": "blocking",
70+
"environmentSelector": {}
2171
}
2272
]

openshift/tests-extension/cmd/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ import (
1919
g "github.com/openshift-eng/openshift-tests-extension/pkg/ginkgo"
2020
"github.com/spf13/cobra"
2121

22-
// The import below is necessary to ensure that the OLMv1 tests are registered with the extension.
22+
"github/operator-framework-operator-controller/openshift/tests-extension/pkg/env"
2323
_ "github/operator-framework-operator-controller/openshift/tests-extension/test"
24-
"github/operator-framework-operator-controller/openshift/tests-extension/test/env"
2524
)
2625

2726
func main() {

openshift/tests-extension/go.mod

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,63 @@ module github/operator-framework-operator-controller/openshift/tests-extension
33
go 1.24.3
44

55
require (
6-
github.com/onsi/ginkgo/v2 v2.22.0
7-
github.com/onsi/gomega v1.36.1
6+
github.com/onsi/ginkgo/v2 v2.23.3
7+
github.com/onsi/gomega v1.37.0
88
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250722101414-8083129ab8f9
99
github.com/openshift/api v0.0.0-20250718204806-3333746edfbf
1010
github.com/openshift/client-go v0.0.0-20250710075018-396b36f983ee
11-
github.com/spf13/cobra v1.8.1
11+
github.com/operator-framework/operator-controller v1.3.0
12+
github.com/spf13/cobra v1.9.1
13+
k8s.io/api v0.33.2
1214
k8s.io/apiextensions-apiserver v0.33.2
1315
k8s.io/apimachinery v0.33.3
1416
k8s.io/client-go v0.33.2
1517
sigs.k8s.io/controller-runtime v0.21.0
1618
)
1719

1820
require (
19-
cel.dev/expr v0.19.1 // indirect
20-
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
21+
cel.dev/expr v0.23.1 // indirect
22+
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
2123
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
22-
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
24+
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
2325
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2426
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
2527
github.com/go-logr/logr v1.4.2 // indirect
2628
github.com/go-openapi/jsonpointer v0.21.0 // indirect
27-
github.com/go-openapi/jsonreference v0.20.2 // indirect
28-
github.com/go-openapi/swag v0.23.0 // indirect
29+
github.com/go-openapi/jsonreference v0.21.0 // indirect
30+
github.com/go-openapi/swag v0.23.1 // indirect
2931
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3032
github.com/gogo/protobuf v1.3.2 // indirect
31-
github.com/google/cel-go v0.23.2 // indirect
33+
github.com/google/cel-go v0.25.0 // indirect
3234
github.com/google/gnostic-models v0.6.9 // indirect
3335
github.com/google/go-cmp v0.7.0 // indirect
34-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
36+
github.com/google/pprof v0.0.0-20250423184734-337e5dd93bb4 // indirect
3537
github.com/google/uuid v1.6.0 // indirect
3638
github.com/inconshreveable/mousetrap v1.1.0 // indirect
3739
github.com/josharian/intern v1.0.0 // indirect
3840
github.com/json-iterator/go v1.1.12 // indirect
39-
github.com/mailru/easyjson v0.7.7 // indirect
41+
github.com/mailru/easyjson v0.9.0 // indirect
4042
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4143
github.com/modern-go/reflect2 v1.0.2 // indirect
4244
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
4345
github.com/pkg/errors v0.9.1 // indirect
44-
github.com/spf13/pflag v1.0.5 // indirect
46+
github.com/spf13/pflag v1.0.6 // indirect
4547
github.com/stoewer/go-strcase v1.3.0 // indirect
4648
github.com/x448/float16 v0.8.4 // indirect
47-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
48-
golang.org/x/net v0.38.0 // indirect
49-
golang.org/x/oauth2 v0.27.0 // indirect
50-
golang.org/x/sys v0.31.0 // indirect
51-
golang.org/x/term v0.30.0 // indirect
52-
golang.org/x/text v0.23.0 // indirect
53-
golang.org/x/time v0.9.0 // indirect
54-
golang.org/x/tools v0.26.0 // indirect
55-
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
56-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
57-
google.golang.org/protobuf v1.36.5 // indirect
49+
golang.org/x/exp v0.0.0-20250228200357-dead58393ab7 // indirect
50+
golang.org/x/net v0.40.0 // indirect
51+
golang.org/x/oauth2 v0.29.0 // indirect
52+
golang.org/x/sys v0.33.0 // indirect
53+
golang.org/x/term v0.32.0 // indirect
54+
golang.org/x/text v0.25.0 // indirect
55+
golang.org/x/time v0.11.0 // indirect
56+
golang.org/x/tools v0.33.0 // indirect
57+
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
58+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250428153025-10db94c68c34 // indirect
59+
google.golang.org/protobuf v1.36.6 // indirect
5860
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
5961
gopkg.in/inf.v0 v0.9.1 // indirect
6062
gopkg.in/yaml.v3 v3.0.1 // indirect
61-
k8s.io/api v0.33.2 // indirect
6263
k8s.io/klog/v2 v2.130.1 // indirect
6364
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
6465
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect

0 commit comments

Comments
 (0)