feat(raft-library): task 5.4 — Groups F+G, 6 test cases (RDHUP failover + split-brain)

This commit is contained in:
Rongsong Shen 2026-05-31 07:05:45 +00:00
parent 5c677bc52d
commit 6bdf7edacf
2 changed files with 261 additions and 1 deletions

View file

@ -128,7 +128,7 @@
- All 7 Unity test cases pass; trace buffer confirms `on_cancel_timeout` fires in E1 and E2
- _Requirements: 4.1, 4.2, 4.3, 4.4, 6.1, 6.2, 6.3, 8.2, 8.3_
- [ ] 5.4 Test Groups F and G: RDHUP failover and split-brain prevention (6 cases)
- [x] 5.4 Test Groups F and G: RDHUP failover and split-brain prevention (6 cases)
- F1: nodes 1 and 2 call `raft_on_leader_lost`; mock `on_start_election_after_delay` receives `1×timeout` for node 1 and `2×timeout` for node 2 (priority-based jitter)
- F2: during node 1's delay, node 1 receives and grants a vote request from another node → `voted_for != self_idx`; `raft_check_and_start_election` returns `RAFT_SKIP_ELECTION`
- F3: `raft_on_leader_lost` followed by `raft_check_and_start_election` with no intervening vote grant → returns `RAFT_ELECTION_STARTED`; `state.role==RAFT_CANDIDATE`