Documentation
¶
Overview ¶
Package fakeclock provides an injectable Clock for tests that exercise time-sensitive logic — hook freshness windows, heartbeat staleness, log-rotation maintenance — without sleeping or depending on wall-clock progress.
Per TUI-TEST-PLAN.md §6.3 (fakeClock): production call sites that currently invoke time.Now() directly (e.g. instance.go's hook fast-path window) must be refactored to take a Clock so they can be driven by Fake in tests. Real{} is the production wiring.
Usage:
c := fakeclock.New(time.Unix(0, 0))
inst.UpdateStatus("running", c.Now())
c.Advance(2 * time.Second)
inst.UpdateStatus("idle", c.Now()) // 2s later from the model's POV
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fake ¶
type Fake struct {
// contains filtered or unexported fields
}
Fake is a controllable clock. Concurrent Now / Advance / Set are safe.
Click to show internal directories.
Click to hide internal directories.