Merge pull request #85258 from liggitt/fuzz-pointer-intstr

Include *intstr.IntOrString in API compatibility test fixtures
This commit is contained in:
Kubernetes Prow Robot 2019-11-14 00:59:43 -08:00 committed by GitHub
commit d11374d330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 82 additions and 26 deletions

View File

@ -1380,7 +1380,7 @@
"updateStrategy": {
"type": "荥ơ'禧ǵŊ)TiD¢ƿ媴h5",
"rollingUpdate": {
"maxUnavailable": 2
}
},
"minReadySeconds": 212061711,

View File

@ -941,7 +941,8 @@ spec:
storagePolicyName: "103"
volumePath: "101"
updateStrategy:
rollingUpdate: {}
rollingUpdate:
maxUnavailable: 2
type: 荥ơ'禧ǵŊ)TiD¢ƿ媴h5
status:
collisionCount: -449319810

View File

@ -1376,7 +1376,8 @@
"strategy": {
"type": "荥ơ'禧ǵŊ)TiD¢ƿ媴h5",
"rollingUpdate": {
"maxUnavailable": 2,
"maxSurge": 3
}
},
"minReadySeconds": 212061711,

View File

@ -41,7 +41,9 @@ spec:
matchLabels:
74404d5---g8c2-k-91e.y5-g--58----0683-b-w7ld-6cs06xj-x5yv0wm-k18/M_-Nx.N_6-___._-.-W._AAn---v_-5-_8LXj: 6-4_WE-_JTrcd-2.-__E_Sv__26KX_R_.-.Nth._--S_4DA_-5_-4lQ42M--1
strategy:
rollingUpdate: {}
rollingUpdate:
maxSurge: 3
maxUnavailable: 2
type: 荥ơ'禧ǵŊ)TiD¢ƿ媴h5
template:
metadata:

View File

@ -1376,7 +1376,8 @@
"strategy": {
"type": "荥ơ'禧ǵŊ)TiD¢ƿ媴h5",
"rollingUpdate": {
"maxUnavailable": 2,
"maxSurge": 3
}
},
"minReadySeconds": 212061711,

View File

@ -43,7 +43,9 @@ spec:
matchLabels:
74404d5---g8c2-k-91e.y5-g--58----0683-b-w7ld-6cs06xj-x5yv0wm-k18/M_-Nx.N_6-___._-.-W._AAn---v_-5-_8LXj: 6-4_WE-_JTrcd-2.-__E_Sv__26KX_R_.-.Nth._--S_4DA_-5_-4lQ42M--1
strategy:
rollingUpdate: {}
rollingUpdate:
maxSurge: 3
maxUnavailable: 2
type: 荥ơ'禧ǵŊ)TiD¢ƿ媴h5
template:
metadata:

View File

@ -1380,7 +1380,7 @@
"updateStrategy": {
"type": "荥ơ'禧ǵŊ)TiD¢ƿ媴h5",
"rollingUpdate": {
"maxUnavailable": 2
}
},
"minReadySeconds": 212061711,

View File

@ -941,7 +941,8 @@ spec:
storagePolicyName: "103"
volumePath: "101"
updateStrategy:
rollingUpdate: {}
rollingUpdate:
maxUnavailable: 2
type: 荥ơ'禧ǵŊ)TiD¢ƿ媴h5
status:
collisionCount: -449319810

View File

@ -1376,7 +1376,8 @@
"strategy": {
"type": "荥ơ'禧ǵŊ)TiD¢ƿ媴h5",
"rollingUpdate": {
"maxUnavailable": 2,
"maxSurge": 3
}
},
"minReadySeconds": 212061711,

View File

@ -41,7 +41,9 @@ spec:
matchLabels:
74404d5---g8c2-k-91e.y5-g--58----0683-b-w7ld-6cs06xj-x5yv0wm-k18/M_-Nx.N_6-___._-.-W._AAn---v_-5-_8LXj: 6-4_WE-_JTrcd-2.-__E_Sv__26KX_R_.-.Nth._--S_4DA_-5_-4lQ42M--1
strategy:
rollingUpdate: {}
rollingUpdate:
maxSurge: 3
maxUnavailable: 2
type: 荥ơ'禧ǵŊ)TiD¢ƿ媴h5
template:
metadata:

View File

@ -43,6 +43,8 @@
"spec": {
"holderIdentity": "19",
"leaseDurationSeconds": 896585016,
"acquireTime": "1970-01-01T00:00:02.000000Z",
"renewTime": "1970-01-01T00:00:03.000000Z",
"leaseTransitions": 1305381319
}
}

View File

@ -30,6 +30,8 @@ metadata:
selfLink: "5"
uid: "7"
spec:
acquireTime: "1970-01-01T00:00:02.000000Z"
holderIdentity: "19"
leaseDurationSeconds: 896585016
leaseTransitions: 1305381319
renewTime: "1970-01-01T00:00:03.000000Z"

View File

@ -43,6 +43,8 @@
"spec": {
"holderIdentity": "19",
"leaseDurationSeconds": 896585016,
"acquireTime": "1970-01-01T00:00:02.000000Z",
"renewTime": "1970-01-01T00:00:03.000000Z",
"leaseTransitions": 1305381319
}
}

View File

@ -30,6 +30,8 @@ metadata:
selfLink: "5"
uid: "7"
spec:
acquireTime: "1970-01-01T00:00:02.000000Z"
holderIdentity: "19"
leaseDurationSeconds: 896585016
leaseTransitions: 1305381319
renewTime: "1970-01-01T00:00:03.000000Z"

View File

@ -1380,7 +1380,7 @@
"updateStrategy": {
"type": "荥ơ'禧ǵŊ)TiD¢ƿ媴h5",
"rollingUpdate": {
"maxUnavailable": 2
}
},
"minReadySeconds": 212061711,

View File

@ -942,7 +942,8 @@ spec:
volumePath: "101"
templateGeneration: 8027668557984017414
updateStrategy:
rollingUpdate: {}
rollingUpdate:
maxUnavailable: 2
type: 荥ơ'禧ǵŊ)TiD¢ƿ媴h5
status:
collisionCount: 2063260600

View File

@ -1376,7 +1376,8 @@
"strategy": {
"type": "荥ơ'禧ǵŊ)TiD¢ƿ媴h5",
"rollingUpdate": {
"maxUnavailable": 2,
"maxSurge": 3
}
},
"minReadySeconds": 212061711,

View File

@ -43,7 +43,9 @@ spec:
matchLabels:
74404d5---g8c2-k-91e.y5-g--58----0683-b-w7ld-6cs06xj-x5yv0wm-k18/M_-Nx.N_6-___._-.-W._AAn---v_-5-_8LXj: 6-4_WE-_JTrcd-2.-__E_Sv__26KX_R_.-.Nth._--S_4DA_-5_-4lQ42M--1
strategy:
rollingUpdate: {}
rollingUpdate:
maxSurge: 3
maxUnavailable: 2
type: 荥ơ'禧ǵŊ)TiD¢ƿ媴h5
template:
metadata:

View File

@ -59,7 +59,8 @@
{
"ports": [
{
"protocol": "Ǐ2啗塧ȱ蓿彭聡A3fƻfʣ"
"protocol": "Ǐ2啗塧ȱ蓿彭聡A3fƻfʣ",
"port": 2
}
],
"from": [
@ -100,7 +101,8 @@
{
"ports": [
{
"protocol": "ɗ"
"protocol": "ɗ",
"port": 3
}
],
"to": [

View File

@ -32,7 +32,8 @@ metadata:
spec:
egress:
- ports:
- protocol: ɗ
- port: 3
protocol: ɗ
to:
- ipBlock:
cidr: "51"
@ -74,7 +75,8 @@ spec:
matchLabels:
yg--79-e-a74bc-v--0jjy45-17-053.zyyms7-tk1po6c-m61733-x-2v4r--5-xgc3-yz-7-x--c0-w5-6r/78A6.6O: 17_.8CnT
ports:
- protocol: Ǐ2啗塧ȱ蓿彭聡A3fƻfʣ
- port: 2
protocol: Ǐ2啗塧ȱ蓿彭聡A3fƻfʣ
podSelector:
matchExpressions:
- key: p503---477-49p---o61---4fy--9---7--9-9s-0-u5lj2--10pq-0-7-9-2-0/fP81.-.9Vdx.TB_M-H_5_.t..bG0

View File

@ -59,7 +59,8 @@
{
"ports": [
{
"protocol": "Ǐ2啗塧ȱ蓿彭聡A3fƻfʣ"
"protocol": "Ǐ2啗塧ȱ蓿彭聡A3fƻfʣ",
"port": 2
}
],
"from": [
@ -100,7 +101,8 @@
{
"ports": [
{
"protocol": "ɗ"
"protocol": "ɗ",
"port": 3
}
],
"to": [

View File

@ -32,7 +32,8 @@ metadata:
spec:
egress:
- ports:
- protocol: ɗ
- port: 3
protocol: ɗ
to:
- ipBlock:
cidr: "51"
@ -74,7 +75,8 @@ spec:
matchLabels:
yg--79-e-a74bc-v--0jjy45-17-053.zyyms7-tk1po6c-m61733-x-2v4r--5-xgc3-yz-7-x--c0-w5-6r/78A6.6O: 17_.8CnT
ports:
- protocol: Ǐ2啗塧ȱ蓿彭聡A3fƻfʣ
- port: 2
protocol: Ǐ2啗塧ȱ蓿彭聡A3fƻfʣ
podSelector:
matchExpressions:
- key: p503---477-49p---o61---4fy--9---7--9-9s-0-u5lj2--10pq-0-7-9-2-0/fP81.-.9Vdx.TB_M-H_5_.t..bG0

View File

@ -41,6 +41,7 @@
]
},
"spec": {
"minAvailable": 2,
"selector": {
"matchLabels": {
"8---jop9641lg.p-g8c2-k-912e5-c-e63-n-3n/E9.8ThjT9s-j41-0-6p-JFHn7y-74.-0MUORQQ.N2.3": "68._bQw.-dG6c-.6--_x.--0wmZk1_8._3s_-_Bq.m_4"
@ -54,7 +55,8 @@
]
}
]
}
},
"maxUnavailable": 3
},
"status": {
"observedGeneration": -6582200896939805980,

View File

@ -30,6 +30,8 @@ metadata:
selfLink: "5"
uid: "7"
spec:
maxUnavailable: 3
minAvailable: 2
selector:
matchExpressions:
- key: p503---477-49p---o61---4fy--9---7--9-9s-0-u5lj2--10pq-0-7-9-2-0/fP81.-.9Vdx.TB_M-H_5_.t..bG0

View File

@ -26,6 +26,7 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/json:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer/protobuf:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/github.com/davecgh/go-spew/spew:go_default_library",
"//vendor/github.com/golang/protobuf/proto:go_default_library",

View File

@ -26,6 +26,7 @@ import (
"strconv"
"strings"
"testing"
"time"
"github.com/google/go-cmp/cmp"
fuzz "github.com/google/gofuzz"
@ -39,6 +40,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/runtime/serializer/json"
"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
)
@ -221,12 +223,30 @@ func CompatibilityTestFuzzer(scheme *runtime.Scheme, fuzzFuncs []interface{}) *f
fuzzer := fuzz.NewWithSeed(0).NilChance(0).NumElements(1, 1).MaxDepth(20)
fuzzer = fuzzer.Funcs(genericfuzzer.Funcs(serializer.NewCodecFactory(scheme))...)
fuzzString := 1
fuzzIntOrString := 1
fuzzMicroTime := int64(1)
fuzzer.Funcs(
// avoid crazy strings
func(s *string, c fuzz.Continue) {
fuzzString++
*s = strconv.Itoa(fuzzString)
},
func(i **intstr.IntOrString, c fuzz.Continue) {
fuzzIntOrString++
tmp := intstr.FromInt(fuzzIntOrString)
_ = tmp
*i = &tmp
},
func(t **metav1.MicroTime, c fuzz.Continue) {
if t != nil && *t != nil {
// use type-defined fuzzing for non-nil objects
(*t).Fuzz(c)
return
}
fuzzMicroTime++
tmp := metav1.NewMicroTime(time.Unix(fuzzMicroTime, 0))
*t = &tmp
},
// limit managed fields to two levels
func(f *[]metav1.ManagedFieldsEntry, c fuzz.Continue) {
field := metav1.ManagedFieldsEntry{}
@ -280,20 +300,20 @@ func (c *CompatibilityTestOptions) runCurrentVersionTest(t *testing.T, gvk schem
} else {
if !bytes.Equal(expectedJSON, actualJSON) {
t.Errorf("json differs")
t.Log(cmp.Diff(string(expectedJSON), string(actualJSON)))
t.Log(cmp.Diff(string(actualJSON), string(expectedJSON)))
needsUpdate = true
}
if !bytes.Equal(expectedYAML, actualYAML) {
t.Errorf("yaml differs")
t.Log(cmp.Diff(string(expectedYAML), string(actualYAML)))
t.Log(cmp.Diff(string(actualYAML), string(expectedYAML)))
needsUpdate = true
}
if !bytes.Equal(expectedProto, actualProto) {
t.Errorf("proto differs")
needsUpdate = true
t.Log(cmp.Diff(dumpProto(t, expectedProto[4:]), dumpProto(t, actualProto[4:])))
t.Log(cmp.Diff(dumpProto(t, actualProto[4:]), dumpProto(t, expectedProto[4:])))
// t.Logf("json (for locating the offending field based on surrounding data): %s", string(expectedJSON))
}
}