pub struct Scenario { /* private fields */ }Expand description
Your workflows and requests, run under seeds. See the module docs.
Implementations§
Source§impl Scenario
impl Scenario
Sourcepub fn new(setup: impl Fn(&mut Setup) + Send + Sync + 'static) -> Self
pub fn new(setup: impl Fn(&mut Setup) + Send + Sync + 'static) -> Self
setup runs once per seed, on a fresh machine, and builds that
seed’s workflows, requests and checks.
Sourcepub fn fault_window(self, d: Duration) -> Self
pub fn fault_window(self, d: Duration) -> Self
How long faults are injected, from the start of the simulation (default 2 s of simulated time). Requests may come later.
Sourcepub fn crash_every(self, d: Duration) -> Self
pub fn crash_every(self, d: Duration) -> Self
Mean time between process crashes in the fault window; zero for none. By default the seed picks none, 150, 400 or 900 ms.
Sourcepub fn flush_failures_per_mille(self, n: u32) -> Self
pub fn flush_failures_per_mille(self, n: u32) -> Self
Flushes that fail, per thousand, in the fault window. By default the seed picks 0, 2 or 10.
Sourcepub fn torn_writes(self, on: bool) -> Self
pub fn torn_writes(self, on: bool) -> Self
Whether a crash tears unflushed writes (default true) or only loses them.
Sourcepub fn no_faults(self) -> Self
pub fn no_faults(self) -> Self
No crashes and no failed flushes: the scheduler and the clock only.
Sourcepub fn settle_within(self, d: Duration) -> Self
pub fn settle_within(self, d: Duration) -> Self
Simulated time every workflow gets to finish once faults stop (default one hour). Workflows that sleep longer need more.