mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +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:
parent
a9c3edc613
commit
a24936355e
@ -195,6 +195,8 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source)
|
|||||||
randomQuantity := func() resource.Quantity {
|
randomQuantity := func() resource.Quantity {
|
||||||
var q resource.Quantity
|
var q resource.Quantity
|
||||||
c.Fuzz(&q)
|
c.Fuzz(&q)
|
||||||
|
// precalc the string for benchmarking purposes
|
||||||
|
_ = q.String()
|
||||||
return q
|
return q
|
||||||
}
|
}
|
||||||
q.Limits = make(api.ResourceList)
|
q.Limits = make(api.ResourceList)
|
||||||
|
Loading…
Reference in New Issue
Block a user