mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
allow apigroups to opt out of proto round trip testing
This commit is contained in:
@@ -51,9 +51,10 @@ import (
|
||||
|
||||
var fuzzIters = flag.Int("fuzz-iters", 20, "How many fuzzing iterations to do.")
|
||||
|
||||
var codecsToTest = []func(version unversioned.GroupVersion, item runtime.Object) (runtime.Codec, error){
|
||||
func(version unversioned.GroupVersion, item runtime.Object) (runtime.Codec, error) {
|
||||
return testapi.GetCodecForObject(item)
|
||||
var codecsToTest = []func(version unversioned.GroupVersion, item runtime.Object) (runtime.Codec, bool, error){
|
||||
func(version unversioned.GroupVersion, item runtime.Object) (runtime.Codec, bool, error) {
|
||||
c, err := testapi.GetCodecForObject(item)
|
||||
return c, true, err
|
||||
},
|
||||
}
|
||||
|
||||
@@ -135,11 +136,14 @@ func roundTripSame(t *testing.T, group testapi.TestGroup, item runtime.Object, e
|
||||
version := *group.GroupVersion()
|
||||
codecs := []runtime.Codec{}
|
||||
for _, fn := range codecsToTest {
|
||||
codec, err := fn(version, item)
|
||||
codec, ok, err := fn(version, item)
|
||||
if err != nil {
|
||||
t.Errorf("unable to get codec: %v", err)
|
||||
return
|
||||
}
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
codecs = append(codecs, codec)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user