[][src]Crate kaos

 Chaotic testing harness

Kaos is a chaotic testing test harness to test your services against random failures. It allows you to add failpoints that panic randomly inside your code and randomizes asserts availability and tolerance for resiliency for these faults.

Kaos Tests

Create a directory that will hold all chaos tests called kaos-tests.

A minimal launcher for kaos setup looks like this:

#[test]
fn kaos() {
    let k = kaos::Runs::new();

    for entry in fs::read_dir("kaos-tests").unwrap() {
        let entry = entry.unwrap();
        let path = entry.path();

        // Every service run should be available at least 2 seconds
        k.available(path, Duration::from_secs(2));
    }
}

and in your Cargo.toml

[[test]]
name = "kaos"
path = "kaos-tests/launcher.rs"

That's all, now what you have to do is run with cargo test.

Kaos is using the same approach that [https://docs.rs/trybuild] has. Instead of being compiler-like test harness, it has diverged to be chaos engineering oriented harness.

Structs

Runs

Chaotic runs test setup