From 98e304044cfb67405b1194a23f3d8f4f2c7b6128 Mon Sep 17 00:00:00 2001 From: riccardom Date: Wed, 10 Jun 2026 15:46:14 +0200 Subject: [PATCH] Moves test helper at te very bottom --- client/mdm/ticker.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/client/mdm/ticker.go b/client/mdm/ticker.go index 273ddfde0..9ffa51e7d 100644 --- a/client/mdm/ticker.go +++ b/client/mdm/ticker.go @@ -23,17 +23,6 @@ const defaultReloadInterval = 1 * time.Minute // always returns false. const testReloadInterval = 1 * time.Second -// reloadInterval returns the production cadence, or the accelerated test -// cadence when running under `go test` (detected via testing.Testing()). -// Centralising the choice here keeps the prod/test split in one place -// and out of the ticker's call sites. -func reloadInterval() time.Duration { - if testing.Testing() { - return testReloadInterval - } - return defaultReloadInterval -} - // policyLoader is the indirection through which the ticker reads the // OS-native policy, both for the initial observation and on every tick. // Production points it at LoadPolicy; tests in this package override it to @@ -50,6 +39,17 @@ type Ticker struct { prev *Policy } +// reloadInterval returns the production cadence, or the accelerated test +// cadence when running under `go test` (detected via testing.Testing()). +// Centralising the choice here keeps the prod/test split in one place +// and out of the ticker's call sites. +func reloadInterval() time.Duration { + if testing.Testing() { + return testReloadInterval + } + return defaultReloadInterval +} + // NewTicker constructs a Ticker that re-reads the OS-native policy // every reloadInterval() and invokes onChange on any diff. The // cadence is owned by reloadInterval (production default, accelerated