Module dst

Module dst 

Source
Expand description

DST - Deterministic Simulation Testing

TigerBeetle/FoundationDB-style deterministic simulation testing framework.

§Philosophy

“If you’re not testing with fault injection, you’re not testing.”

§Usage

use umi_memory::dst::{Simulation, SimConfig, FaultConfig, FaultType};

#[tokio::test]
async fn test_storage_survives_faults() {
    let sim = Simulation::new(SimConfig::with_seed(42))
        .with_fault(FaultConfig::new(FaultType::StorageWriteFail, 0.1));

    sim.run(|env| async move {
        env.storage.write("key", b"value").await?;
        env.clock.advance_ms(1000);
        let result = env.storage.read("key").await?;
        assert_eq!(result, Some(b"value".to_vec()));
        Ok(())
    }).await.unwrap();
}

Run with explicit seed for reproducibility:

DST_SEED=12345 cargo test

Structs§

DeterministicRng
A deterministic random number generator.
FaultConfig
Configuration for a specific fault.
FaultInjector
Fault injector for simulation testing.
FaultInjectorBuilder
Builder for FaultInjector (Kelpie pattern).
NetworkMessage
A network message in flight.
PropertyTest
Property-based test runner.
PropertyTestFailure
Details of a property test failure.
PropertyTestResult
Result of a property test run.
SimClock
A simulated clock for deterministic testing.
SimConfig
Configuration for a simulation run.
SimEnvironment
Environment provided to simulation tests.
SimLLM
Simulated LLM for deterministic testing.
SimNetwork
Simulated network for DST.
SimStorage
Simulated storage for DST testing.
Simulation
DST simulation harness.
TimeAdvanceConfig
Configuration for time advancement during property tests.

Enums§

FaultType
Types of faults that can be injected.
LLMError
Errors from LLM operations.
NetworkError
Network errors.
StorageError
Storage errors.

Traits§

PropertyTestable
Trait for systems that can be property-tested.

Functions§

create_simulation
Create a simulation with optional seed.
run_property_tests
Run multiple property tests with different seeds.
test_seeds
Generate a set of test seeds including edge cases.

Type Aliases§

StorageReadError
Read-specific error alias.
StorageWriteError
Write-specific error alias.