Get the latest tech news
Quartz: A Deterministic Time Testing Library for Go
Learn how we enhanced TCP performance in Coder to achieve 5X faster throughput by optimizing buffer sizes, implementing the HyStart algorithm, and minimizing packet loss, significantly improving remote development experiences.
Compress 30 minutes into 30ms and your tests may no longer do things in the order you expect, since consumer operating systems don’t make hard guarantees about real-time processing. By mocking out calls that query or depend on the real time, we can write unit tests that are repeatable, deterministic, and execute as quickly as the CPU allows. This test case will fail with our bugged implementation, since the triggered AfterFunc won't call timeoutLocked() and instead will reset the timer with a negative number.
Or read this on Hacker News