test(ha-peer-connection-reuse): complete tasks 7.1, 7.2, 7.3 — all validation done
Task 7.1 (unit tests) was already complete with 8 tests in test_ha_connection_reuse.c. Added two new tests: Task 7.2 — test_follower_passive_no_outbound_connect (Req 2.1, 2.4): Verifies raft_cb_become_follower sets role=CTRL_STANDBY and nulls all votes[i].ep. The old fetch_config_from_primary path is gone; standbys never initiate outbound connects after election loss. Task 7.3 — test_promoted_ep_repl_ack_promotes_to_primary (Req 5.2, 5.4): Injects two OPCode_replCatchUpDone packets via peer_ctrl_msg_handler in CTRL_PRIMARY_COMMITTING with n_peers=4 (5-node cluster, quorum=2 ACKs). Verifies repl_ack_count reaches 2 and role transitions to CTRL_PRIMARY. Added vote_ep_ctx_set_cluster_for_test() seam so vctx->c is non-NULL when ha_repl_ack_received fires ha_promote_to_primary. All 62 controller tests pass; ASAN clean. spec: .kiro/specs/ha-peer-connection-reuse/tasks.md all tasks [x]
This commit is contained in:
parent
78b7942bbe
commit
e85100d761
4 changed files with 730 additions and 0 deletions
|
|
@ -548,6 +548,15 @@ extern void (*ha_rdhup_election_hook)(ha_state_t *ha, cluster_t *c,
|
|||
int n_peers, xce_candidate_t **peers,
|
||||
uint64_t my_config_tag, uint64_t my_lsn,
|
||||
const char *my_name);
|
||||
|
||||
/*
|
||||
* vote_ep_ctx_set_cluster_for_test: set the cluster_t pointer inside the
|
||||
* vote_ep_ctx_t stored at ep->data. Used by unit tests that need
|
||||
* ha_repl_ack_received to call ha_promote_to_primary(c) when quorum is reached.
|
||||
* The vote_ep_ctx_t struct is internal to ha.c; this helper avoids exposing it.
|
||||
* Requirements: task 7.3 (ha-peer-connection-reuse).
|
||||
*/
|
||||
void vote_ep_ctx_set_cluster_for_test(struct endpoint_t *ep, cluster_t *c);
|
||||
#endif
|
||||
|
||||
#endif /* HA_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue