Documentation
¶
Overview ¶
Package userstatetest is the conformance harness every userstate.Store implementation must pass.
It exists for the same reason internal/store/storetest does: three backends without a shared contract test are three subtly different behaviors, and the one that diverges is the one nobody runs locally. The expiry and replace-don't-stack rules in particular are easy to implement plausibly-but-differently in Go maps, on disk, and in SQL.
Every assertion here is deterministic — no wall clock, no sleeps — because userstate.Store takes `now` as a parameter. A suite that slept would be slow and flaky and would still not pin the boundary conditions.
Index ¶
- func RunAll(t *testing.T, f Factory)
- func RunClosedTests(t *testing.T, f Factory)
- func RunIsolationTests(t *testing.T, f Factory)
- func RunMuteTests(t *testing.T, f Factory)
- func RunPruneTests(t *testing.T, f Factory)
- func RunShownTests(t *testing.T, f Factory)
- func RunSnoozeTests(t *testing.T, f Factory)
- type Factory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunClosedTests ¶
RunClosedTests pins that a closed store fails loudly rather than silently accepting writes that go nowhere.
func RunIsolationTests ¶
RunIsolationTests pins that state is scoped per user. A leak here shows a user someone else's snoozes — mild in itself, but it would also mean the keying is wrong in a way that corrupts cooldown for everyone.
func RunMuteTests ¶
RunMuteTests pins per-source muting and its reversibility.
func RunPruneTests ¶
RunPruneTests pins housekeeping. Pruning must never change an answer — only reclaim space — so correctness cannot depend on it having run.
func RunShownTests ¶
RunShownTests pins the last-shown record backing cooldown.
func RunSnoozeTests ¶
RunSnoozeTests pins snooze semantics, including the boundary condition and the replace-don't-stack rule.