mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 14:45:28 +00:00
Precalculate String() for fuzzed Quantity
Avoids biasing serialization results where the value is assumed to be in canonical form already.
This commit is contained in:
@@ -195,6 +195,8 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source)
|
||||
randomQuantity := func() resource.Quantity {
|
||||
var q resource.Quantity
|
||||
c.Fuzz(&q)
|
||||
// precalc the string for benchmarking purposes
|
||||
_ = q.String()
|
||||
return q
|
||||
}
|
||||
q.Limits = make(api.ResourceList)
|
||||
|
Reference in New Issue
Block a user