@@ -1048,7 +1048,7 @@ metadata:
1048
1048
}
1049
1049
})
1050
1050
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 () {
1052
1052
ginkgo .By ("prepare CRD with partially-specified validation schema" )
1053
1053
crd , err := crd .CreateTestCRD (f , func (crd * apiextensionsv1.CustomResourceDefinition ) {
1054
1054
props := & apiextensionsv1.JSONSchemaProps {}
@@ -1074,15 +1074,6 @@ metadata:
1074
1074
1075
1075
meta := fmt .Sprintf (metaPattern , crd .Crd .Spec .Names .Kind , crd .Crd .Spec .Group , crd .Crd .Spec .Versions [0 ].Name , "test-cr" )
1076
1076
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
-
1086
1077
// unknown fields on the root are considered valid
1087
1078
validArbitraryCR := fmt .Sprintf (`{%s,"spec":{"bars":[{"name":"test-bar"}]},"extraProperty":"arbitrary-value"}` , meta )
1088
1079
err = createApplyCustomResource (validArbitraryCR , f .Namespace .Name , "test-cr" , crd )
0 commit comments