Skip to content

Commit f12d001

Browse files
committed
Revert "Adjust testing for server-side validation as default"
This reverts commit f234cb1.
1 parent 3452291 commit f12d001

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

test/e2e/kubectl/kubectl.go

+1-10
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ metadata:
10481048
}
10491049
})
10501050

1051-
ginkgo.It("should create/apply an invalid/valid CR with arbitrary-extra properties for CRD with partially-specified validation schema", func() {
1051+
ginkgo.It("should create/apply a valid CR with arbitrary-extra properties for CRD with partially-specified validation schema", func() {
10521052
ginkgo.By("prepare CRD with partially-specified validation schema")
10531053
crd, err := crd.CreateTestCRD(f, func(crd *apiextensionsv1.CustomResourceDefinition) {
10541054
props := &apiextensionsv1.JSONSchemaProps{}
@@ -1074,15 +1074,6 @@ metadata:
10741074

10751075
meta := fmt.Sprintf(metaPattern, crd.Crd.Spec.Names.Kind, crd.Crd.Spec.Group, crd.Crd.Spec.Versions[0].Name, "test-cr")
10761076

1077-
// XPreserveUnknownFields is defined on the root of the schema so unknown fields within the spec
1078-
// are still considered invalid
1079-
invalidArbitraryCR := fmt.Sprintf(`{%s,"spec":{"bars":[{"name":"test-bar"}],"extraProperty":"arbitrary-value"}}`, meta)
1080-
err = createApplyCustomResource(invalidArbitraryCR, f.Namespace.Name, "test-cr", crd)
1081-
framework.ExpectError(err, "creating custom resource")
1082-
if !strings.Contains(err.Error(), `unknown field "spec.extraProperty"`) {
1083-
framework.Failf("incorrect error from createApplyCustomResource: %v", err)
1084-
}
1085-
10861077
// unknown fields on the root are considered valid
10871078
validArbitraryCR := fmt.Sprintf(`{%s,"spec":{"bars":[{"name":"test-bar"}]},"extraProperty":"arbitrary-value"}`, meta)
10881079
err = createApplyCustomResource(validArbitraryCR, f.Namespace.Name, "test-cr", crd)

0 commit comments

Comments
 (0)