Testing Concurrent Go with synctest
Notes from Alexander Baygeldin’s GopherCon 2026 talk, “(Sync)testing Concurrent Code with Confidence.” Testing concurrent code used to mean picking one of three bad options: hacky (poke at internals), flaky (time.Sleep(100 * time.Millisecond) and hope), or slow (sleep long enough that it’s reliable). testing/synctest removes the tradeoff by giving the test a fake clock. The fake clock Inside synctest.Test, time doesn’t pass on its own. It jumps forward only when every goroutine in the bubble is blocked. A one-hour timeout resolves instantly and deterministically. ...