What it does
Most code is tested only on the happy path. Real systems fail through:
- Partial writes
- Disk full mid-flush
- Connection resets
- Corrupted reads
- Permission denied
- Process crashes
dev-chaos injects these failures on purpose so you can verify that
your recovery logic works.
Quick start
[]
= "0.1"
use ;
// Fail on the 3rd, 7th, and 10th attempt of some operation.
let schedule = on_attempts;
let mut observed_failures = 0;
for attempt in 1..=12
let final_state_ok = true; // your invariant check
let check = assert_recovered;
Design choices
- Deterministic by default. Schedules are explicit. You know which attempt fails before the test runs.
- No probabilistic chaos. Random failures are useful for
exploratory testing but not for repeatable verification. If you
need that, layer randomness on top of
FailureSchedule. - Recovery is the verdict, not the failure. A test passes when the system recovers, not when the failure was injected.
What's planned
- IO wrappers:
ChaosFile,ChaosNetworkthat inject failures into real Read/Write/AsyncRead/AsyncWrite types. - Process kill simulators with
dev-fixturesintegration. - Latency injection (slow but-not-failing operations).
- Crash-and-restart helpers paired with WAL recovery testing.
License
Apache-2.0. See LICENSE.