carlos / platform Public

hostfiles: the rate-limit tests count over twenty polling periods with bounds no loaded runner can cross

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 0ecc893d1a2cecc117cd18e0716af796b07034e9 parent 6c8571d
1 file changed, +8 −6
  • internal/hostfiles/run_test.go +8 −6
diff --git a/internal/hostfiles/run_test.go b/internal/hostfiles/run_test.go
index 5ed8ca61c..cabf8bbfd 100644
--- a/internal/hostfiles/run_test.go
+++ b/internal/hostfiles/run_test.go
@@ -292,13 +292,15 @@ func TestRunRepairsAtMostOncePerPollAndLogsTheTransitionOnce(t *testing.T) {
w.repairErr = errors.New("watch limit reached")
p := open(t, s)
stop := startRun(t, p, dir, w, polled)
- time.Sleep(10 * polled.Poll)
+ time.Sleep(20 * polled.Poll)
stop()
w.mu.Lock()
n := w.repairs
w.mu.Unlock()
- if n < 3 || n > 13 { // ten periods; a tick is a quarter of the deadline, so per-tick would be ~40
- t.Fatalf("%d repair attempts in ten polling periods; want about ten", n)
+ // Twenty periods; a tick is a quarter of the deadline, so per-tick
+ // would be ~80. The bounds are wide so a loaded CI runner cannot flake.
+ if n < 2 || n > 30 {
+ t.Fatalf("%d repair attempts in twenty polling periods; want about twenty", n)
}
if got := logs.count("watch coverage is missing"); got != 1 {
t.Fatalf("coverage-missing logged %d times, want once", got)
@@ -348,14 +350,14 @@ func TestRunRetriesAFailingScanOncePerPollAndLogsItOnce(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
done := make(chan error, 1)
go func() { done <- run(ctx, p, dir, polled, newFake()) }()
- time.Sleep(10 * polled.Poll)
+ time.Sleep(20 * polled.Poll)
cancel()
<-done
fs.mu.Lock()
n := fs.puts
fs.mu.Unlock()
- if n < 3 || n > 13 {
- t.Fatalf("%d scan attempts in ten polling periods; want about ten", n)
+ if n < 2 || n > 30 { // per-tick would be ~80; see the repair test
+ t.Fatalf("%d scan attempts in twenty polling periods; want about twenty", n)
}
if got := logs.count("scan failing"); got != 1 {
t.Fatalf("the failure was logged %d times, want once", got)