Hoverbear / old-raft-rs

[Incomplete] A Raft implementation in Rust
https://hoverbear.github.io/raft-rs/raft/
MIT License
266 stars 41 forks source link

Test Harness #86

Open Hoverbear opened 8 years ago

Hoverbear commented 8 years ago

It may be useful to have the debug builds of Raft feature a testing harness. This could be used to simulate failure, delays, etc. Up in the air about what it might even look like, but I assume we could use some #[cfg(feature = "harness")] or some manner or speaking.

Possible features:

WildCryptoFox commented 8 years ago

87 first. Notably: No event loop required in simulation without networking. Delays can be done with thread sleeps or mio. Handling the order between simulated peers - they could be talking via a channel and so all nodes can be walked at the same time flushing all queues (including those newly added due to actions).

Partitioning would be to just split the available peers per simulation and run them independently. Partition and merge functions in the simulator will need to cover this.

EDIT: The most important thing to note here is that the tests would be deterministic without I/O or platform specific code. With no side affects - the tests become proofs.