test(ha-prevote): genuine-failover, re-attach, and liveness-rearm scenarios (task 5.3)

Three scenario tests (zero production change): a stale-heartbeat standby GRANTS
(grant<->deny flip vs 5.2) and the won round advances to CTRL_ELECTING (PreVote
does not block legitimate failover); a heartbeat mid-round cancels and re-attaches
as standby with term unchanged; a lost round re-arms liveness and a later genuine
failure still wins (reusable, not one-shot).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-06-16 07:09:01 +00:00
parent 86ac7c4863
commit 22fa753fa6
2 changed files with 243 additions and 1 deletions

View file

@ -78,7 +78,7 @@
- _Requirements: 4.1, 4.3, 4.4_
- _Depends: 3.1, 4.1, 4.2, 5.1_
- [ ] 5.3 Genuine-failover and re-attach scenario tests
- [x] 5.3 Genuine-failover and re-attach scenario tests
- Add scenario tests: dead primary with stale peer heartbeats → PreVotes granted → a new primary is elected within the existing election-timeout bounds; heartbeat mid-round → clean re-attach; failed PreVote → liveness watchdog re-armed so a later real failure still elects.
- Observable: a genuine primary death elects a new primary, and the suppressed cases never do.
- _Requirements: 5.1, 5.4, 4.2_