Skip to content

s2-streamstore/mad-turmoil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mad-turmoil

madsim-inspired determinism for turmoil-based simulation tests

See blog post

Setup

Make sure you are only depending on this crate for simulation binaries!

fn main() -> eyre::Result<()> {
    let rng_seed = std::env::var("DST_SEED")?.parse()?;

    // Taming randomness...

    let mut rng = StdRng::seed_from_u64(rng_seed);
    mad_turmoil::rand::set_rng(rng.clone());
    assert_eq!(rng.next_u64(), mad_turmoil::rand::get_rng().next_u64());

    // Additionally, if you are using fastrand (possibly transitively!)
    fastrand::seed(rng_seed);

    // Taming time...

    let _tokio_time_guard = mad_turmoil::time::SimClocksGuard::init();

    // Go forth and create turmoil...
}

About

madsim-inspired determinism for turmoil-based simulation tests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages