Introducing Quartz: A Deterministic Time Testing Library for Go
Quartz is a deterministic time testing library for Go, designed to help developers write repeatable and reliable tests for code that depends on time. It addresses common issues with time-dependent code such as flaky tests, race conditions, and non-deterministic behavior. By mocking out calls that query or depend on the real time, Quartz enables unit tests that are repeatable, deterministic, and execute as quickly as the CPU allows. The library includes features like trapping clock calls, waiting for advancements in time, and ensuring a well-defined state of both the clock and the unit under test to prevent flakes and races.
Company
Coder
Date published
July 8, 2024
Author(s)
Spike Curtis
Word count
2085
Language
English
Hacker News points
133