test(ha): add term-adoption regression tests for heartbeat/WAL-NACK vectors (bug-1484)

bug-1421 added two term-discovery fallback vectors so a stale-term primary
steps down instead of retrying AppendEntries forever: heartbeat-reply
state-report term adoption and WAL-NACK reply_term adoption, both inside
repl_ack_decode_and_dispatch. Neither had a test driving the real
production dispatch path and asserting raft_on_higher_term_observed
actually fires.

Adds two tests mirroring test_config_repl.c's existing config-push term
test, driving peer_ctrl_msg_handler -> repl_ack_decode_and_dispatch via
wire-shape capnp packets. Both pass immediately -- the underlying bug-1421
code was already correct, just unverified end-to-end -- closing
raft-adapter-conformance's Requirement 7.5 unverified claim.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXkenK8rqE8mdS1YKjsq78
This commit is contained in:
Rongsong Shen 2026-08-02 04:36:46 +00:00
parent f16733ee61
commit 8e75b0c10c
3 changed files with 253 additions and 0 deletions

View file

@ -151,6 +151,7 @@ controller_unit_test_src = [
'testsuite/test_commit_resolve.c',
'testsuite/test_ha_vep_teardown.c',
'testsuite/test_ha_dispatch_integration.c',
'testsuite/test_term_adoption_vectors.c',
'testsuite/test_ha_core_safety.c',
'testsuite/test_ha_partition.c',
'testsuite/test_waldump.c',