Documentation
¶
Overview ¶
Package testutil provides shared test fixtures for cells/accesscore tests.
IMPORTANT: This package MUST NOT be imported by production code. It is scoped under internal/ so only cells/accesscore/** can reach it; archtest rule LAYER-TESTUTIL further enforces the rule.
Why a non-_test.go file: the helpers are needed across multiple sibling packages (cells/accesscore/slices/{identitymanage,sessionlogout,rbaccheck}/...); _test.go visibility cannot cross package boundaries.
Verified: no production (non-_test.go) file imports this package (confirmed by `git grep -l "cells/accesscore/internal/testutil" -- '*.go' ':!*_test.go'` returning empty output).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RealRefreshStore ¶
RealRefreshStore returns a ready-to-use in-memory refresh.Store for unit tests. It uses a permissive policy suitable for test scenarios.
func RealSessionRepo ¶
RealSessionRepo returns a ready-to-use in-memory session.Store for unit tests. It wires the canonical test Protocol (sessiontest.Protocol — JTI-ref fingerprint, AuthzEpoch ordering, all CredentialEvents enabled) and a real clock. The returned store is safe for concurrent use (MemStore has an internal RWMutex).
sessiontest.Protocol lives in runtime/auth/session/sessiontest/ so that SESSION-PROTOCOL-COMPOSITION-ROOT-01 archtest covers Protocol construction inside the allowlisted path; this helper itself does not call session.NewProtocol directly (session.MustNewProtocol was deleted in B2-K-02).
Types ¶
type RecordingWriter ¶
RecordingWriter is test-only and does NOT satisfy L2 durability semantics (no retry, no idempotency, no transactional row visibility). Production code must use adapters/postgres OutboxWriter.
It records every Entry written to it. Tests assert against Entries to verify L2 OutboxFact semantics (transactional outbox row presence, EventType, payload shape, eventId).
Set Err to simulate failure for negative-path tests; when Err is non-nil, Write returns Err immediately and Entries is not appended (rolling-back callers must observe the error propagating from RunInTx).