Reuse CreateTestCRD helper for kubectl e2e

This commit is contained in:
Maciej Szulik 2024-09-23 18:32:27 +02:00
parent 15d08bf7c8
commit b51d6308a7
No known key found for this signature in database
GPG Key ID: F15E55D276FA84C4

View File

@ -1235,7 +1235,7 @@ metadata:
ginkgo.It("should detect unknown metadata fields in both the root and embedded object of a CR", func(ctx context.Context) { ginkgo.It("should detect unknown metadata fields in both the root and embedded object of a CR", func(ctx context.Context) {
ginkgo.By("prepare CRD with x-kubernetes-embedded-resource: true") ginkgo.By("prepare CRD with x-kubernetes-embedded-resource: true")
opt := func(crd *apiextensionsv1.CustomResourceDefinition) { testCRD, err := crd.CreateTestCRD(f, func(crd *apiextensionsv1.CustomResourceDefinition) {
props := &apiextensionsv1.JSONSchemaProps{} props := &apiextensionsv1.JSONSchemaProps{}
if err := yaml.Unmarshal(schemaFooEmbedded, props); err != nil { if err := yaml.Unmarshal(schemaFooEmbedded, props); err != nil {
framework.Failf("failed to unmarshal schema: %v", err) framework.Failf("failed to unmarshal schema: %v", err)
@ -1250,10 +1250,7 @@ metadata:
}, },
}, },
} }
} })
group := fmt.Sprintf("%s.example.com", f.BaseName)
testCRD, err := crd.CreateMultiVersionTestCRD(f, group, opt)
if err != nil { if err != nil {
framework.Failf("failed to create test CRD: %v", err) framework.Failf("failed to create test CRD: %v", err)
} }