fault

package
v1.17.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type Store struct {
	*inmemory.Wrapped
	// contains filtered or unexported fields
}

Store wraps an in-memory state store and selectively fails Multi (transactional) operations whose keys contain a configured substring.

func New

func New(t *testing.T) *Store

New returns a Store that is functionally identical to the in-memory store until ArmFailures is called.

func (*Store) ArmFailures

func (s *Store) ArmFailures(keySubstring string, n int, notify chan struct{})

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

func (s *Store) FailedCount() int

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

func (s *Store) MultiMaxSize() int

MultiMaxSize advertises no per-transaction key limit so the test can freely batch saves through the in-memory implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL