test(raft-adapter-conformance): PreVote post-connect failure routing + fast-quorum coverage
Adds pre_vote_ep_err_handler_for_test (XCE_TESTING-guarded) and two tests: PreVote post-connect failure reaches pre_vote_reply_dispatch's tally (Req 4.3), and a round mixing that failure mode with a delivered reply reaches its quorum decision via the fast all-replied path without the full round timeout (Req 4.5). Real-vote coverage (Req 4.2) was already proven by task 3.1's own test, cited not duplicated. pre_vote_reply_dispatch has no mock hook seam, so both tests assert directly on raft_state_t's tally fields, mirroring test_ha_prevote.c's existing verification technique. 1061 -> 1063 tests, 0 failures.
This commit is contained in:
parent
b315ffe466
commit
62db70d16d
3 changed files with 187 additions and 1 deletions
|
|
@ -40,7 +40,7 @@
|
|||
- _Requirements: 4.2, 4.3, 4.4_
|
||||
- _Boundary: ha.c vote endpoint handlers_
|
||||
|
||||
- [ ] 3.2 Test post-connect vote and pre-vote failure routing
|
||||
- [x] 3.2 Test post-connect vote and pre-vote failure routing
|
||||
- Extend the existing test-construction helper (`vote_ep_ctx_build_for_test`) to synthesize a post-connect failure on a real-vote endpoint and assert it reaches `vote_reply_dispatch`'s tally
|
||||
- Do the same for a PreVote endpoint against `pre_vote_reply_dispatch`
|
||||
- Confirm a round where every peer's outcome is now counted (including this failure mode) reaches a quorum decision without waiting for the full round timeout
|
||||
|
|
@ -119,3 +119,5 @@
|
|||
- Task 2.2 (bug-1482): `myreq_handler`'s first unconditional step is `xce_decode(pkt, &request)`, which itself unconditionally `free_packet(pkt)` + frees the `io_packet_t` struct before returning on every path — `pkt` ownership transfers into `xce_decode`, the caller must never touch/free it afterward. Any new `_for_test` wrapper around `myreq_handler` (or `xce_decode` callers generally) must document this, not the reverse ("caller owns/frees pkt") — that wrong assumption is what caused the original test-only wrapper's doc comment to mislead a reviewer into requesting a double-free.
|
||||
- Task 2.2: driving a test through `cluster.c`'s real `myreq_handler` (rather than testing extracted logic in isolation) requires adding `cluster.c` to `controller_unit_test_src` in `meson.build` plus link-satisfying fakes for symbols its OTHER unrelated switch-cases reference (task.c/opget.c/sched.c/apiserver.c/myconf.c) — this is pre-existing, established convention in this codebase (`test_worker_join.c`, `test_commit_barrier_reply.c` already do it for the same reason), not scope creep. Any new test driving `myreq_handler` end-to-end should expect this same footprint.
|
||||
- New test-only wrappers exposing a `static` production dispatch function (the `_for_test` pattern, e.g. `peer_ctrl_msg_handler_for_test`, `myreq_handler_for_test`) MUST be wrapped in `#ifdef XCE_TESTING`/`#endif` — the source file compiles into the production binary too, and an unguarded wrapper ships as a new linked symbol in production with zero production purpose.
|
||||
- Task 3.2 (bug-1483, not fixed): driving a PreVote round to `RAFT_PRE_VOTE_LOST` in a unit test (`c==NULL`) without first stubbing `ha_prevote_rearm_liveness_hook` falls through to the real `ha_arm_heartbeat_timeout_vtask`, which callocs into the static `s_liveness_ctx` and never frees it when `c==NULL` short-circuits the scheduling guard. `test_ha_prevote.c`'s existing LOST-path tests already stub-and-reset this hook — any new PreVote-round test that reaches LOST must do the same.
|
||||
- `pre_vote_reply_dispatch` has no `XCE_TESTING` mock-hook seam (unlike `vote_reply_dispatch`'s `xce_vote_reply_hook`) — it calls `raft_on_pre_vote_reply` directly. Tests verifying PreVote routing must assert on `raft_state_t`'s own tally fields (`pre_vote_replies[]`, `pre_votes_granted`, `pre_vote_in_progress`) instead, per `test_ha_prevote.c`'s established technique.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue