Problem
connection_health_test.go relies on time.Sleep to wait for the worker goroutine to execute, which can be flaky on slow or loaded CI runners.
Proposed Solution
Replace sleep-based synchronization with one of:
RunOnce() method — expose a single-tick execution path that the test calls directly, removing the need for goroutines entirely.
- Channel-based sync — have mock methods (
GetForHealthCheck, UpdateHealthStatus) signal on a channel so the test blocks until the expected call completes.
Option 1 is preferred as it simplifies tests and removes timing sensitivity altogether.
Files Affected
internal/service/connection_health.go — add RunOnce() or equivalent
internal/service/connection_health_test.go — rewrite to use deterministic sync
Priority
Low — the current 200ms sleep works reliably but is technically non-deterministic.
Problem
connection_health_test.gorelies ontime.Sleepto wait for the worker goroutine to execute, which can be flaky on slow or loaded CI runners.Proposed Solution
Replace sleep-based synchronization with one of:
RunOnce()method — expose a single-tick execution path that the test calls directly, removing the need for goroutines entirely.GetForHealthCheck,UpdateHealthStatus) signal on a channel so the test blocks until the expected call completes.Option 1 is preferred as it simplifies tests and removes timing sensitivity altogether.
Files Affected
internal/service/connection_health.go— addRunOnce()or equivalentinternal/service/connection_health_test.go— rewrite to use deterministic syncPriority
Low — the current 200ms sleep works reliably but is technically non-deterministic.