Commit 1f5b9c1
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
| 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