Skip to content

Commit

Permalink
Update CSR fuzzing to match defaulting
Browse files Browse the repository at this point in the history
  • Loading branch information
liggitt committed Jul 31, 2020
1 parent 6324c13 commit 1e621ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/apis/certificates/fuzzer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/apis/certificates/fuzzer",
deps = [
"//pkg/apis/certificates:go_default_library",
"//pkg/apis/core:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/github.com/google/gofuzz:go_default_library",
],
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/certificates/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/kubernetes/pkg/apis/certificates"
api "k8s.io/kubernetes/pkg/apis/core"
)

// Funcs returns the fuzzer functions for the certificates api group.
Expand All @@ -31,5 +32,11 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
obj.Usages = []certificates.KeyUsage{certificates.UsageKeyEncipherment}
obj.SignerName = "example.com/custom-sample-signer"
},
func(obj *certificates.CertificateSigningRequestCondition, c fuzz.Continue) {
c.FuzzNoCustom(obj) // fuzz self without calling this function again
if len(obj.Status) == 0 {
obj.Status = api.ConditionTrue
}
},
}
}

0 comments on commit 1e621ab

Please sign in to comment.