Fuzz label selectors

Previously, we did not have custom code for fuzzing label selectors.
Anything that used a label selector (like Scale) had to manually bypass
fuzzing the selector, or write its own fuzzer.  This introduces a fuzzer
for label selectors which generates random correct selectors with random
keys and values.
This commit is contained in:
Solly Ross
2017-10-13 14:57:28 -04:00
parent d61a2d9037
commit ef583aeed2
2 changed files with 136 additions and 0 deletions

View File

@@ -104,6 +104,15 @@ func TestSetControllerConversion(t *testing.T) {
fuzzInternalObject(t, extGroup.InternalGroupVersion(), rs, rand.Int63())
// explicitly set the selector to something that is convertible to old-style selectors
// (since normally we'll fuzz the selectors with things that aren't convertible)
rs.Spec.Selector = &metav1.LabelSelector{
MatchLabels: map[string]string{
"foo": "bar",
"baz": "quux",
},
}
t.Logf("rs._internal.extensions -> rs.v1beta1.extensions")
data, err := runtime.Encode(extGroup.Codec(), rs)
if err != nil {