Documentation
¶
Overview ¶
Package storeconformance provides a shared conformance test suite for the port.SessionStore interface. Adapters (the in-memory default, the JSONL replay store, remote drivers, ...) call Run with a factory that constructs a fresh store, and the suite exercises only the port.SessionStore interface against sessions built through the session aggregate's public API.
Importing "testing" in a non-_test.go file is intentional here: this is a test-helper package whose sole purpose is to be imported by adapter tests, the conventional Go pattern for shared conformance suites (cf. testing/fstest and the sibling fsconformance/memconformance packages).
The suite pins the CONTRACT, not the implementation: snapshot encoding, durability across reopen, and file layout are adapter-internal and deliberately NOT asserted here. There is no separate self-test — the memstore run site IS the in-engine validation (memstore is the reference in-memory store; adding a second in-memory fake would only duplicate it).
Index ¶
- func Run(t *testing.T, newStore func(t *testing.T) port.SessionStore)
- func RunConditionalPrunable(t *testing.T, newStore func(t *testing.T) port.SessionStore)
- func RunMetadataPager(t *testing.T, newStore func(t *testing.T) port.SessionStore)
- func RunPrunable(t *testing.T, newStore func(t *testing.T) port.SessionStore)
- func RunSessionCreator(t *testing.T, ...)
- func RunSessionMigration(t *testing.T, newStore func(t *testing.T) port.SessionStore, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes the shared SessionStore conformance table against the store produced by newStore. newStore must return a fresh, isolated store each call.
func RunConditionalPrunable ¶
RunConditionalPrunable executes the atomic metadata-revalidation cleanup contract against stores that advertise port.ConditionalPrunableStore.
func RunMetadataPager ¶
RunMetadataPager executes the shared optional metadata-pager contract against every store that advertises port.SessionMetadataPager.
func RunPrunable ¶
RunPrunable executes the shared port.PrunableStore conformance table against the store produced by newStore (which must also implement port.PrunableStore — the suite fails fast otherwise). Like Run, it pins the MECHANISM only: List returns what was saved with sane ModifiedAt values, Delete removes and is idempotent. Retention POLICY (which ids are prunable, age thresholds, per-family caps) is the caller's business and is deliberately NOT asserted here.
func RunSessionCreator ¶
func RunSessionCreator(t *testing.T, newSharedStores func(t *testing.T) (port.SessionStore, port.SessionStore))
RunSessionCreator executes the optional atomic first-publication contract. newSharedStores must return two handles backed by the same authoritative storage so the concurrent case exercises backend, not process-local, exclusion.
func RunSessionMigration ¶
func RunSessionMigration(t *testing.T, newStore func(t *testing.T) port.SessionStore, seedMigratable func(t *testing.T, st port.SessionStore) session.SessionID)
RunSessionMigration exercises the shared port.SessionMigrationStore contract: acquisition-gated mutation, cross-acquisition exclusion, ownership rejection, and durable job-checkpoint round-tripping. It does NOT assert on adapter-private physical format (on-disk layout, Redis key shapes, ...) — only the port-level behavior every implementation must honor identically.
seedMigratable must write ONE pre-migration ("not yet on the current indexed format") session family directly, in whatever way is appropriate for that adapter, and return its ID. Neither in-tree adapter's ordinary port.SessionStore.Save path produces a migratable candidate — Save already writes the current format — so this cannot be done generically through the port alone; each adapter's own test supplies its existing internal seeding helper (e.g. jsonlstore's seedMigrationV1, or writing directly into miniredis for redisstore) as this hook.
Types ¶
This section is empty.