wgengine/magicsock: use testingutil.MinAllocsPerRun
This speeds up and deflakes the test. Fixes #2826 (again) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
4bb2c6980d
commit
c1d377078d
|
@ -44,6 +44,7 @@ import (
|
||||||
"tailscale.com/types/wgkey"
|
"tailscale.com/types/wgkey"
|
||||||
"tailscale.com/util/cibuild"
|
"tailscale.com/util/cibuild"
|
||||||
"tailscale.com/util/racebuild"
|
"tailscale.com/util/racebuild"
|
||||||
|
"tailscale.com/util/testingutil"
|
||||||
"tailscale.com/wgengine/filter"
|
"tailscale.com/wgengine/filter"
|
||||||
"tailscale.com/wgengine/wgcfg"
|
"tailscale.com/wgengine/wgcfg"
|
||||||
"tailscale.com/wgengine/wgcfg/nmcfg"
|
"tailscale.com/wgengine/wgcfg/nmcfg"
|
||||||
|
@ -1348,9 +1349,9 @@ func TestReceiveFromAllocs(t *testing.T) {
|
||||||
}
|
}
|
||||||
t.Logf("allowing %d allocs for Go version %q", maxAllocs, runtime.Version())
|
t.Logf("allowing %d allocs for Go version %q", maxAllocs, runtime.Version())
|
||||||
roundTrip := setUpReceiveFrom(t)
|
roundTrip := setUpReceiveFrom(t)
|
||||||
avg := int(testing.AllocsPerRun(1000, roundTrip))
|
err := testingutil.MinAllocsPerRun(t, uint64(maxAllocs), roundTrip)
|
||||||
if avg > maxAllocs {
|
if err != nil {
|
||||||
t.Fatalf("expected %d allocs in ReceiveFrom, got %v", maxAllocs, avg)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue