Skip to content

Commit 9b57a96

Browse files
authored
Merge pull request kubernetes#130675 from pacoxu/fix-ut-flake
fix a flake of TestRoundTripTypes: for FirstAvailable[].AllocationMode
2 parents 0791d6e + ce16394 commit 9b57a96

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/apis/resource/fuzzer/fuzzer.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
3939
}[c.Int31n(2)]
4040
}
4141
},
42+
func(r *resource.DeviceSubRequest, c randfill.Continue) {
43+
c.FillNoCustom(r) // fuzz self without calling this function again
44+
if r.AllocationMode == "" {
45+
r.AllocationMode = []resource.DeviceAllocationMode{
46+
resource.DeviceAllocationModeAll,
47+
resource.DeviceAllocationModeExactCount,
48+
}[c.Int31n(2)]
49+
}
50+
},
4251
func(r *resource.DeviceAllocationConfiguration, c randfill.Continue) {
4352
c.FillNoCustom(r)
4453
if r.Source == "" {

0 commit comments

Comments
 (0)