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:
Rongsong Shen 2026-07-29 14:38:36 +00:00
parent b315ffe466
commit 62db70d16d
3 changed files with 187 additions and 1 deletions

View file

@ -7670,6 +7670,19 @@ static int pre_vote_ep_err_handler(void *ep_raw)
return 0;
}
#ifdef XCE_TESTING
/*
* pre_vote_ep_err_handler_for_test: call the static pre_vote_ep_err_handler on
* ep. Allows tests to invoke the PreVote err_handler without going through
* iomgr/endpoint machinery — the PreVote twin of vote_ep_err_handler_for_test
* (raft-adapter-conformance task 3.2).
*/
int pre_vote_ep_err_handler_for_test(endpoint_t *ep)
{
return pre_vote_ep_err_handler((void *)ep);
}
#endif /* XCE_TESTING */
/* ── ha_init_raft: one-time raft state machine initialization ────────────────
*
* Called once at startup after ha_restore_term() to wire the raft state