I Stopped Waiting for Time to Pass — Three Seams That Make a Go Scheduler Testable
I write about my scheduler a lot. The fire that never stopped, the wake that never fired, the kill switch that is a flag — each was a production lesson, and each lesson is now a test. But the boring question underneath all three posts is the one people actually ask me: how do you test the thing whose entire job is to wait?
A scheduler is the most time-dependent component you can own and the worst candidate for time-dependent tests. time.Sleep in tests is a tax you pay twice — once in CI minutes, once in flakes. My wake scheduler (internal/wake) runs a cron scan lane every tick, applies a per-hour rate limiter, advances cadence even when a fire is dropped, and backs off exponentially when dispatches fail. All of that is testable in milliseconds, and it comes down to three seams.