carlos / platform Public

Probe burst limit: skip the flood allocation test under -race

TestBurstSingleKeyFloodBounded counts allocations, and the race runtime
allocates on paths that allocate nothing in a normal build, so it failed
under -race. A build-tagged raceEnabled const skips it there; normal runs
keep it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 6679cfc4112c0923c24c67550b91f61b1bd459a3 parent a1286ae
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
diff --git a/internal/edge/burst_test.go b/internal/edge/burst_test.go
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() {
diff --git a/internal/edge/race_off_test.go b/internal/edge/race_off_test.go
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
diff --git a/internal/edge/race_on_test.go b/internal/edge/race_on_test.go
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