mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Unit tests to assure List type not support fieldvalidation
This commit is contained in:
parent
e78d05daec
commit
9e7737d7d4
@ -19,6 +19,7 @@ package resource
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
openapi_v2 "github.com/google/gnostic/openapiv2"
|
openapi_v2 "github.com/google/gnostic/openapiv2"
|
||||||
yaml "gopkg.in/yaml.v2"
|
yaml "gopkg.in/yaml.v2"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
@ -69,6 +69,16 @@ func TestSupportsQueryParam(t *testing.T) {
|
|||||||
supports: false,
|
supports: false,
|
||||||
queryParam: QueryParamFieldValidation,
|
queryParam: QueryParamFieldValidation,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
gvk: schema.GroupVersionKind{
|
||||||
|
Group: "",
|
||||||
|
Version: "v1",
|
||||||
|
Kind: "List",
|
||||||
|
},
|
||||||
|
success: false,
|
||||||
|
supports: false,
|
||||||
|
queryParam: QueryParamFieldValidation,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
@ -124,6 +134,11 @@ func TestFieldValidationVerifier(t *testing.T) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("Random doesn't support fieldValidation, yet no error found")
|
t.Fatalf("Random doesn't support fieldValidation, yet no error found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = fieldValidationVerifier.HasSupport(schema.GroupVersionKind{Group: "", Version: "v1", Kind: "List"})
|
||||||
|
if err == nil {
|
||||||
|
t.Fatalf("List does not support fieldValidation, yet no error found")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type EmptyOpenAPI struct{}
|
type EmptyOpenAPI struct{}
|
||||||
@ -159,4 +174,9 @@ func TestFieldValidationVerifierNoOpenAPI(t *testing.T) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("MyCRD doesn't support fieldValidation, yet no error found")
|
t.Fatalf("MyCRD doesn't support fieldValidation, yet no error found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = fieldValidationVerifier.HasSupport(schema.GroupVersionKind{Group: "", Version: "v1", Kind: "List"})
|
||||||
|
if err == nil {
|
||||||
|
t.Fatalf("List does not support fieldValidation, yet no error found")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user