turmoil 0.5.0

Simulation testing framework for distributed systems
Documentation

Turmoil

This is very experimental

Add hardship to your tests.

Turmoil is a framework for developing and 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. The network can be controlled manually or with a seeded rng.

Crates.io Documentation Build Status Discord chat

Quickstart

Add this to your Cargo.toml.

[dev-dependencies]
turmoil = "0.5"

Next, create a test file and add a test:

let mut sim = turmoil::Builder::new().build();

// register a host
sim.host("server", || async move {
    // host software goes here

    Ok(())
});

// register a client
sim.client("client", async move {
    // dns lookup for "server"
    let addr = turmoil::lookup("server");

    // test code goes here

    Ok(())
});

// run the simulation
sim.run();

See ping_pong in udp.rs for a networking example. For more examples, check out the tests directory.

tokio_unstable

Turmoil uses unhandled_panic to forward host panics as test failures. See unstable features to opt in.

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.