Avoid background update goroutines in api tests

This commit is contained in:
rcourtman 2026-03-25 13:57:49 +00:00
parent 2e0d974bb3
commit fd13d7f59e

View file

@ -209,11 +209,14 @@ func NewRouter(cfg *config.Config, monitor *monitoring.Monitor, mtMonitor *monit
r.setupRoutes()
log.Debug().Msg("Routes registered successfully")
// Start forwarding update progress to WebSocket
go r.forwardUpdateProgress()
// Start background update checker
go r.backgroundUpdateChecker()
// Package tests construct many routers in parallel and expect them to stay
// side-effect free. Skipping these long-lived goroutines under `go test`
// avoids nondeterministic update checks and leaked background work while
// preserving the normal runtime behavior.
if !runningUnderGoTest() {
go r.forwardUpdateProgress()
go r.backgroundUpdateChecker()
}
// Load system settings once at startup and cache them
r.reloadSystemSettings()