Skip to main content

Module fault

Module fault 

Source
Expand description

A fault-injecting [ObjectStore] wrapper, for drills against a store that misbehaves.

Every production bound in this crate – the retry budget, the retry deadline, the request and connect timeouts – exists because a real object store throttles, stalls, and fails. None of that is reachable from a test that only ever meets a store which answers. FaultInjectingStore wraps any other store and, per operation, delays the call and then fails it with the error the backend would have produced.

The failure schedule is deterministic, not random: a rate of 500 per thousand fails every second call to that operation, always the same ones, so a suite that asserts on which call failed asserts on a fact rather than on a seed.

This is a testing seam. Nothing in the broker’s serving path constructs it. Tests can wrap an existing store directly or use build_faulty_object_store to hand a fault policy to code that takes an Arc<dyn ObjectStore>.

Structs§

FaultInjectingStore
An [ObjectStore] that delays and fails calls according to a FaultPolicy, delegating everything it does not fail to an inner store.
FaultPolicy
Which operations misbehave, and how.
OpFault
What one operation class does under fault injection.

Enums§

FaultKind
What a failing call fails with.
StoreOp
The operation classes a FaultPolicy can single out.

Functions§

build_faulty_object_store
Build the store cfg selects and wrap it in policy.