Documentation
¶
Overview ¶
Package fault provides a state.Store implementation that wraps the in-memory store and lets tests deterministically inject transient transactional save failures keyed by a substring of the operation key. Tests use this to verify that workflow / actor code recovers cleanly from state-store hiccups (no stuck workflows, no orphan reminders).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
Store wraps an in-memory state store and selectively fails Multi (transactional) operations whose keys contain a configured substring.
func New ¶
New returns a Store that is functionally identical to the in-memory store until ArmFailures is called.
func (*Store) ArmFailures ¶
ArmFailures arms the store to return an injected transient error on the next n transactional Multi requests whose operation keys contain keySubstring. n=1 produces a one-shot failure, n=0 disarms. If notify is non-nil it is closed the FIRST time a matching Multi is failed, so callers can synchronise on the failure firing.
func (*Store) FailedCount ¶
FailedCount returns the total number of Multi requests that have been failed by this Store since it was constructed.
func (*Store) Multi ¶
Multi implements state.TransactionalStore. If the store is armed and the request touches a key containing the armed substring, the request is failed with a synthetic transient error; otherwise the request is delegated to the underlying in-memory store.
func (*Store) MultiMaxSize ¶
MultiMaxSize advertises no per-transaction key limit so the test can freely batch saves through the in-memory implementation.