2025-12-16 06:55:44 +01:00
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
|
|
use testing_framework_core::scenario::ScenarioBuilder;
|
|
|
|
|
use testing_framework_workflows::{ChaosBuilderExt, ScenarioBuilderExt};
|
|
|
|
|
|
2025-12-18 22:48:45 +01:00
|
|
|
use crate::SnippetResult;
|
|
|
|
|
|
|
|
|
|
pub fn determinism_first() -> SnippetResult<()> {
|
2025-12-16 06:55:44 +01:00
|
|
|
// Separate: functional test (deterministic)
|
|
|
|
|
let _plan = ScenarioBuilder::topology_with(|t| t.network_star().validators(2).executors(1))
|
|
|
|
|
.transactions_with(|txs| {
|
|
|
|
|
txs.rate(5) // 5 transactions per block
|
|
|
|
|
})
|
|
|
|
|
.expect_consensus_liveness()
|
2025-12-18 22:48:45 +01:00
|
|
|
.build()?;
|
2025-12-16 06:55:44 +01:00
|
|
|
|
|
|
|
|
// Separate: chaos test (introduces randomness)
|
|
|
|
|
let _chaos_plan =
|
|
|
|
|
ScenarioBuilder::topology_with(|t| t.network_star().validators(3).executors(2))
|
|
|
|
|
.enable_node_control()
|
|
|
|
|
.chaos_with(|c| {
|
|
|
|
|
c.restart()
|
|
|
|
|
.min_delay(Duration::from_secs(30))
|
|
|
|
|
.max_delay(Duration::from_secs(60))
|
|
|
|
|
.target_cooldown(Duration::from_secs(45))
|
|
|
|
|
.apply()
|
|
|
|
|
})
|
|
|
|
|
.transactions_with(|txs| {
|
|
|
|
|
txs.rate(5) // 5 transactions per block
|
|
|
|
|
})
|
|
|
|
|
.expect_consensus_liveness()
|
2025-12-18 22:48:45 +01:00
|
|
|
.build()?;
|
|
|
|
|
Ok(())
|
2025-12-16 06:55:44 +01:00
|
|
|
}
|