Commit 9f99dcb
committed
test: turmoil: route openraft RNG and spawn through DeterministicRng
Override `AsyncRuntime` in the test's `TypeConfig` so openraft's
internal randomness honors 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`.1 parent 2a42ad1 commit 9f99dcb
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
0 commit comments