mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
do not round trip embedded v2
This commit is contained in:
parent
32ca378825
commit
679dc8322c
@ -22,6 +22,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
"k8s.io/kube-openapi/pkg/common"
|
||||
"k8s.io/kube-openapi/pkg/handler"
|
||||
"k8s.io/kube-openapi/pkg/validation/spec"
|
||||
)
|
||||
@ -44,6 +45,12 @@ func TestOpenAPIRoundtrip(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
// Remove the embedded v2 schema if it presents.
|
||||
// The v2 schema either become the schema (when serving v2) or get pruned (v3)
|
||||
// and it is never round-tripped.
|
||||
delete(roundTripped.Extensions, common.ExtensionV2Schema)
|
||||
delete(value.Schema.Extensions, common.ExtensionV2Schema)
|
||||
|
||||
if !reflect.DeepEqual(value.Schema, roundTripped) {
|
||||
t.Errorf("unexpected diff (a=expected,b=roundtripped):\n%s", diff.ObjectReflectDiff(value.Schema, roundTripped))
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user