Skip to main content

LabTestConfig

Struct LabTestConfig 

Source
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: u64

Seed for deterministic scheduling.

§chaos_enabled: bool

Whether to enable chaos injection.

§chaos_intensity: f64

Chaos intensity (0.0 = none, 1.0 = max).

§max_steps: Option<u64>

Maximum steps before timeout (prevents infinite loops).

§capture_traces: bool

Whether to capture traces for debugging.

Implementations§

Source§

impl LabTestConfig

Source

pub fn new(seed: u64) -> Self

Creates a new Lab test configuration with the given seed.

Source

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.

Source

pub fn with_heavy_chaos(self) -> Self

Enables heavy chaos injection (10% cancel, 20% delay).

Suitable for thorough stress testing before releases.

Source

pub fn with_chaos_intensity(self, intensity: f64) -> Self

Sets custom chaos intensity (0.0 to 1.0).

Source

pub fn with_max_steps(self, max: u64) -> Self

Sets the maximum number of steps before timeout.

Source

pub fn without_step_limit(self) -> Self

Disables the step limit (use with caution).

Source

pub fn with_traces(self) -> Self

Enables trace capture for debugging.

Trait Implementations§

Source§

impl Clone for LabTestConfig

Source§

fn clone(&self) -> LabTestConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LabTestConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LabTestConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ResponseProduces<T> for T