3 files changed,
+16
−0
internal/edge/burst_test.go
+3 −0
internal/edge/race_off_test.go
+6 −0
internal/edge/race_on_test.go
+7 −0
| index 18152ccc6..115a048a2 100644 |
| --- a/internal/edge/burst_test.go |
| +++ b/internal/edge/burst_test.go |
| @@ -358,6 +358,9 @@ func TestBurstReadsTheClockUnderTheLock(t *testing.T) { |
| } |
| |
| func TestBurstSingleKeyFloodBounded(t *testing.T) { |
| + if raceEnabled { |
| + t.Skip("counts allocations, and the race runtime adds its own") |
| + } |
| b, c := burstTestLimiter() |
| // A flood that never lets 60 land inside a window: one note per 2 s. |
| allocs := testing.AllocsPerRun(1, func() { |
| new file mode 100644 |
| index 000000000..aada0d517 |
| --- /dev/null |
| +++ b/internal/edge/race_off_test.go |
| @@ -0,0 +1,6 @@ |
| +//go:build !race |
| + |
| +package edge |
| + |
| +// raceEnabled is false in a normal build; see race_on_test.go. |
| +const raceEnabled = false |
| new file mode 100644 |
| index 000000000..563951e39 |
| --- /dev/null |
| +++ b/internal/edge/race_on_test.go |
| @@ -0,0 +1,7 @@ |
| +//go:build race |
| + |
| +package edge |
| + |
| +// raceEnabled is true under -race, whose runtime allocates on paths that |
| +// allocate nothing in a normal build, so allocation-count tests skip there. |
| +const raceEnabled = true |