pub struct LabTestConfig {
pub seed: u64,
pub chaos_enabled: bool,
pub chaos_intensity: f64,
pub max_steps: Option<u64>,
pub capture_traces: bool,
}Expand description
Configuration for Lab-based deterministic testing.
This configuration controls how the Lab runtime executes tests, including virtual time, chaos injection, and deterministic scheduling.
§Example
use fastapi_core::testing::{LabTestConfig, LabTestClient};
// Basic deterministic test
let config = LabTestConfig::new(42);
let client = LabTestClient::with_config(my_handler, config);
// With chaos injection for stress testing
let config = LabTestConfig::new(42).with_light_chaos();
let client = LabTestClient::with_config(my_handler, config);Fields§
§seed: u64Seed for deterministic scheduling.
chaos_enabled: boolWhether to enable chaos injection.
chaos_intensity: f64Chaos intensity (0.0 = none, 1.0 = max).
max_steps: Option<u64>Maximum steps before timeout (prevents infinite loops).
capture_traces: boolWhether to capture traces for debugging.
Implementations§
Source§impl LabTestConfig
impl LabTestConfig
Sourcepub fn with_light_chaos(self) -> Self
pub fn with_light_chaos(self) -> Self
Enables light chaos injection (1% cancel, 5% delay).
Suitable for CI pipelines - catches obvious bugs without excessive flakiness.
Sourcepub fn with_heavy_chaos(self) -> Self
pub fn with_heavy_chaos(self) -> Self
Enables heavy chaos injection (10% cancel, 20% delay).
Suitable for thorough stress testing before releases.
Sourcepub fn with_chaos_intensity(self, intensity: f64) -> Self
pub fn with_chaos_intensity(self, intensity: f64) -> Self
Sets custom chaos intensity (0.0 to 1.0).
Sourcepub fn with_max_steps(self, max: u64) -> Self
pub fn with_max_steps(self, max: u64) -> Self
Sets the maximum number of steps before timeout.
Sourcepub fn without_step_limit(self) -> Self
pub fn without_step_limit(self) -> Self
Disables the step limit (use with caution).
Sourcepub fn with_traces(self) -> Self
pub fn with_traces(self) -> Self
Enables trace capture for debugging.
Trait Implementations§
Source§impl Clone for LabTestConfig
impl Clone for LabTestConfig
Source§fn clone(&self) -> LabTestConfig
fn clone(&self) -> LabTestConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more