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 testStructs§
- Deterministic
Rng - A deterministic random number generator.
- Fault
Config - Configuration for a specific fault.
- Fault
Injector - Fault injector for simulation testing.
- Fault
Injector Builder - Builder for FaultInjector (Kelpie pattern).
- Network
Message - A network message in flight.
- Property
Test - Property-based test runner.
- Property
Test Failure - Details of a property test failure.
- Property
Test Result - 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.
- Time
Advance Config - Configuration for time advancement during property tests.
Enums§
- Fault
Type - Types of faults that can be injected.
- LLMError
- Errors from LLM operations.
- Network
Error - Network errors.
- Storage
Error - Storage errors.
Traits§
- Property
Testable - 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§
- Storage
Read Error - Read-specific error alias.
- Storage
Write Error - Write-specific error alias.