Skip to main content

Module fault

Module fault 

Source
Expand description

Crash simulation for testing recovery. The injector is enabled by the fault-injection feature.

A FaultInjector armed at a FaultPoint stops the runtime there:

  • Fault::Crash panics inside the runtime’s task. Nothing after the point runs: no further writes, no lease release, no heartbeat. The caller gets a RuntimeError::Internal, and a new runtime over the same store plays the restarted process.
  • Fault::Abort calls std::process::abort, killing the process at that exact point, for tests that run the runtime in a subprocess.

An action already spawned when the crash hits keeps running, like a request already on the wire.

ⓘ
let injector = Arc::new(FaultInjector::new().at(FaultPoint::AfterActionReturned).crash());
let runtime = Runtime::builder(store).fault_injector(Arc::clone(&injector)).build();

Structs§

Arming
A point being armed; finish with Arming::crash or Arming::abort.
FaultInjector
Stops the runtime at chosen points. Each armed fault fires once.

Enums§

Fault
What happens at an armed point.
FaultPoint
Where in an effect’s execution a crash can be injected, in the order they are reached.