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)
|
2026-01-26 08:26:15 +01:00
|
|
|
let _plan = ScenarioBuilder::topology_with(|t| t.network_star().nodes(2))
|
2025-12-16 06:55:44 +01:00
|
|
|
.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)
|
2026-01-26 08:26:15 +01:00
|
|
|
let _chaos_plan = ScenarioBuilder::topology_with(|t| t.network_star().nodes(3))
|
2026-01-25 10:11:16 +02:00
|
|
|
.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()
|
|
|
|
|
.build()?;
|
2025-12-18 22:48:45 +01:00
|
|
|
Ok(())
|
2025-12-16 06:55:44 +01:00
|
|
|
}
|