mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
Merge pull request #116247 from ardaguclu/skip-hassupport-check-for-list
Skip hasSupport check for List type
This commit is contained in:
commit
1692de5f17
@ -72,6 +72,10 @@ const (
|
||||
|
||||
// HasSupport checks if the given gvk supports the query param configured on v
|
||||
func (v *QueryParamVerifier) HasSupport(gvk schema.GroupVersionKind) error {
|
||||
if (gvk == schema.GroupVersionKind{Version: "v1", Kind: "List"}) {
|
||||
return NewParamUnsupportedError(gvk, v.queryParam)
|
||||
}
|
||||
|
||||
oapi, err := v.openAPIGetter.OpenAPISchema()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to download openapi: %v", err)
|
||||
|
@ -69,6 +69,16 @@ func TestSupportsQueryParam(t *testing.T) {
|
||||
supports: false,
|
||||
queryParam: QueryParamFieldValidation,
|
||||
},
|
||||
{
|
||||
gvk: schema.GroupVersionKind{
|
||||
Group: "",
|
||||
Version: "v1",
|
||||
Kind: "List",
|
||||
},
|
||||
success: false,
|
||||
supports: false,
|
||||
queryParam: QueryParamFieldValidation,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
@ -124,6 +134,11 @@ func TestFieldValidationVerifier(t *testing.T) {
|
||||
if err == nil {
|
||||
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{}
|
||||
@ -159,4 +174,9 @@ func TestFieldValidationVerifierNoOpenAPI(t *testing.T) {
|
||||
if err == nil {
|
||||
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