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.
Add this to your Cargo.toml.
[dev-dependencies]
turmoil = "0.7"See crate documentation for simulation setup instructions.
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.
This project is licensed under the MIT license.
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.