-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed as duplicate of#67434
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
With https://github.com/jmhodges/clock and the broader https://github.com/benbjohnson/clock API, there's a desire for the timing systems in Go to be fakeable[1]. Using a fake clock instead of time.Now directly is useful when testing code that stores timestamps, caches data, etc. The benbjohnson clock package attempts to make Ticker and Timer calls (as well as their related AfterFunc and Sleep methods) work against a fake time that can be set and updated in tests. However, it relies on some micro-sleeps and runtime.Gosched calls that are obviously going to be flaky. But there is a desire to able to test code that uses Tickers and Timers, not by adjusting the durations they work for (which can induce flaky testing), but by adjusting when they think they need to wake up. To do that, we seem to need more runtime magic to help developers out. In fact, it might be best if a clock package like these lived in the stdlib so that it could be tied more carefully and thoughtfully to the scheduler. [1] or "mockable", whatever language you prefer. The summary of this issue is to distinguish it from issue #5356.
flimzy, retr0h, samouss, skipor, anurag and 28 more
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.