Documentation
¶
Overview ¶
Package storetest provides a reusable contract test suite for refresh.Store implementations. Backends (memstore, postgres) each run RunContractSuite to prove they honor the same append-only + single-sentinel semantics.
Test identifiers T1-T23 map to Store invariants: T1-T2 Issue, T3 Rotate happy path, T4 grace window, T5 reuse-after-grace, T6-T8 fail-closed rejection paths, T9 RevokeSession cascade, T10 concurrent Rotate CAS, T11 ExpiresAt calculation, T12 errcode sentinel category, T13 GC cleanup, T14 concurrent goroutine race model, T15 reuse-after-grace cascade, T16 grace-inside-interval, T17 parse-failure uniformity, T18 RevokeUser, T19-T20 Peek preflight/rejection, T21 Peek does not consume grace budget, T22 detached session revoke, T23 reuse-after-grace returns ErrReused.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunContractSuite ¶
RunContractSuite runs T1-T23 against factory. Each T is a t.Run sub-test.
func RunIdleExpireContractSuite ¶
RunIdleExpireContractSuite runs the idle-expiry sub-test against the given factory. It stays separate from RunContractSuite so backend contract runners can name the MaxIdle policy coverage explicitly. Both memstore and PG invoke this suite from their main contract tests.
Test identifiers Tn_IdleExpire_* are the contract for MaxIdle enforcement: a token that has not been rotated within MaxIdle of creation must be rejected with ErrRejected; the rejection reason is idle_expired.
Types ¶
type Factory ¶
Factory constructs a fresh Store and its deterministic clock. Backends with per-test setup (e.g. PG schema reset) do it inside Factory.
type FakeClock ¶
FakeClock is a type alias for clockmock.FakeClock; storetest historically owned its own implementation but the canonical one is now in kernel/clock/clockmock. The alias is retained so existing test wiring keeps using `storetest.FakeClock` through this package's Factory return type.
func NewFakeClock ¶
NewFakeClock constructs a FakeClock anchored at the supplied time. Delegates to clockmock.New.