Skip to content

Commit 13e95db

Browse files
committed
Register API versions with test scheme in validation tests
The conversion webhook does not try to register conversions for versions which are not present in the scheme.
1 parent 750b84d commit 13e95db

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test/e2e/suites/apivalidations/suite_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ import (
3838
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
3939
"sigs.k8s.io/controller-runtime/pkg/webhook"
4040

41+
infrav1alpha1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha1"
42+
infrav1alpha5 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha5"
43+
infrav1alpha6 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha6"
44+
infrav1alpha7 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
4145
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1"
4246
"sigs.k8s.io/cluster-api-provider-openstack/pkg/webhooks"
4347
)
@@ -83,9 +87,15 @@ var _ = BeforeSuite(func() {
8387
})
8488

8589
testScheme = scheme.Scheme
86-
Expect(infrav1.AddToScheme(testScheme)).To(Succeed())
87-
88-
//+kubebuilder:scaffold:scheme
90+
for _, f := range []func(*runtime.Scheme) error{
91+
infrav1alpha1.AddToScheme,
92+
infrav1alpha5.AddToScheme,
93+
infrav1alpha6.AddToScheme,
94+
infrav1alpha7.AddToScheme,
95+
infrav1.AddToScheme,
96+
} {
97+
Expect(f(testScheme)).To(Succeed())
98+
}
8999

90100
k8sClient, err = client.New(cfg, client.Options{Scheme: testScheme})
91101
Expect(err).NotTo(HaveOccurred())

0 commit comments

Comments
 (0)