Skip to content

Commit 1f5b9c1

Browse files
committed
test: turmoil: route openraft RNG and spawn through DeterministicRng
Override `AsyncRuntime` in the test's `TypeConfig` so openraft's internal `thread_rng()` and `spawn` honor the per-host deterministic seed already set up by `cluster.rs`. `declare_raft_types!` defaults `AsyncRuntime` to plain `TokioRuntime`, whose `thread_rng()` is `rand::rng()` (OS-seeded) and whose `spawn` is `tokio::spawn`. Each host enters `DeterministicRng::scope`, but plain runtime calls bypass the task-local `DETSIM_SEED` entirely — election timeouts and child-task seeds came from the OS RNG, so the cluster diverged across runs even after the prior fuzz-driver determinism fix. `DeterministicRng<TokioRuntime>` routes both `thread_rng()` and `spawn` through the wrapper that consults `DETSIM_SEED`, completing the determinism story for `--reproduce`.
1 parent 4c142be commit 1f5b9c1

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tests-turmoil/src/typ.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ openraft::declare_raft_types!(
4949
D = Request,
5050
R = Response,
5151
Node = Node,
52+
AsyncRuntime = openraft_rt::deterministic_rng::DeterministicRng<openraft_rt_tokio::TokioRuntime>,
5253
);
5354

5455
pub type Raft = openraft::Raft<TypeConfig, std::sync::Arc<crate::store::StateMachine>>;

0 commit comments

Comments
 (0)