25 releases
| 0.7.1 | Jan 29, 2026 |
|---|---|
| 0.7.0 | Nov 3, 2025 |
| 0.6.6 | Mar 10, 2025 |
| 0.6.4 | Oct 9, 2024 |
| 0.3.2 | Nov 14, 2022 |
#88 in Network programming
353,279 downloads per month
Used in 24 crates
(17 directly)
355KB
6.5K
SLoC
Turmoil
This is very experimental
Add hardship to your tests.
Turmoil is a framework for testing distributed systems. It provides deterministic execution by running multiple concurrent hosts within a single thread. It introduces "hardship" into the system via changes in the simulated network and filesystem. Both can be controlled manually or with a seeded rng.
Quickstart
Add this to your Cargo.toml.
[dev-dependencies]
turmoil = "0.7"
See crate documentation for simulation setup instructions.
Examples
Filesystem Simulation (unstable)
Requires the unstable-fs feature.
[dev-dependencies]
turmoil = { version = "0.7", features = ["unstable-fs"] }
Turmoil provides simulated filesystem types for crash-consistency testing:
use turmoil::fs::shim::std::fs::OpenOptions;
use turmoil::fs::shim::std::os::unix::fs::FileExt;
let file = OpenOptions::new()
.read(true)
.write(true)
.create(true)
.open("/data/db")?;
file.write_all_at(b"data", 0)?;
file.sync_all()?; // Data now durable, survives sim.crash()
Each host has isolated filesystem state. Use Builder::fs_sync_probability() to
configure random sync behavior for testing crash recovery.
License
This project is licensed under the MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in turmoil by you, shall be licensed as MIT,
without any additional terms or conditions.
Dependencies
~9–13MB
~142K SLoC