docs(raft-adapter-conformance): document dormant AppendEntries sender + non-regression guard
ha_cb_send_append_entries_stub's doc-comment now plainly states it is reachable only via raft_send_append_entries (zero production callers, grep-confirmed), and names repl_broadcast/ha_stream_wal_to_standby as the actual production send/retry/backoff mechanism (Req 3.3, amended to permit this documentation-only resolution over retire-or-wire-in). Adds an XCE_TESTING-only ha_send_append_entries_stub_call_count counter, mirroring the ha_wal_ack_send_hook idiom, as the guard against this ever silently regaining a production caller. Task 4.2 will drive the real production path and assert it stays zero. 1063 -> 1064 tests, 0 failures. Zero behavior change to any production send path.
This commit is contained in:
parent
62db70d16d
commit
6d798df35d
4 changed files with 111 additions and 2 deletions
|
|
@ -2645,6 +2645,38 @@ static void test_6_2_real_senders_never_produce_termblind_shape(void)
|
|||
printf("test_6_2_real_senders_never_produce_termblind_shape: done\n");
|
||||
}
|
||||
|
||||
/* Task 4.1 (raft-adapter-conformance, Requirement 3.3) sanity check: this is
|
||||
* NOT task 4.2's "drives the production heartbeat/replication path
|
||||
* end-to-end and asserts the counter stays at zero" non-regression test —
|
||||
* that test belongs to task 4.2 and lives separately. This is only a
|
||||
* trivial proof that the counter itself works: it is directly
|
||||
* readable/resettable from a test (XCE_TESTING extern linkage, ha.h) and
|
||||
* increments by exactly one per invocation of ha_cb_send_append_entries_stub
|
||||
* (driven here via the existing ha_cb_send_append_entries_for_test seam).
|
||||
* ha==NULL still reaches the increment — it is the very first statement in
|
||||
* the callback body, before the ha/raft_c NULL guard — so this needs no
|
||||
* cluster/persist fixture at all. */
|
||||
static void test_4_1_send_append_entries_stub_call_count_increments(void)
|
||||
{
|
||||
ha_send_append_entries_stub_call_count = 0;
|
||||
|
||||
int rc = ha_cb_send_append_entries_for_test(NULL, /*peer*/0,
|
||||
/*prev_idx*/0, /*prev_term*/0,
|
||||
/*leader_commit*/0, /*n*/0);
|
||||
TEST_ASSERT_EQUAL_INT(-EINVAL, rc);
|
||||
TEST_ASSERT_EQUAL_UINT64_MESSAGE(1, ha_send_append_entries_stub_call_count,
|
||||
"ha_send_append_entries_stub_call_count must increment once per "
|
||||
"ha_cb_send_append_entries_stub invocation");
|
||||
|
||||
rc = ha_cb_send_append_entries_for_test(NULL, /*peer*/0, 0, 0, 0, 0);
|
||||
TEST_ASSERT_EQUAL_INT(-EINVAL, rc);
|
||||
TEST_ASSERT_EQUAL_UINT64_MESSAGE(2, ha_send_append_entries_stub_call_count,
|
||||
"the counter must accumulate across multiple invocations, not just "
|
||||
"latch at 1");
|
||||
|
||||
printf("test_4_1_send_append_entries_stub_call_count_increments: PASS\n");
|
||||
}
|
||||
|
||||
/* ── Suite entry point ─────────────────────────────────────────────────────*/
|
||||
|
||||
void test_ha_core_safety(void)
|
||||
|
|
@ -2740,4 +2772,9 @@ void test_ha_core_safety(void)
|
|||
* above and in ha.c. */
|
||||
RUN_TEST(test_6_2_restart_preserves_term_identity);
|
||||
RUN_TEST(test_6_2_real_senders_never_produce_termblind_shape);
|
||||
/* Task 4.1 (raft-adapter-conformance) sanity check: the new
|
||||
* ha_send_append_entries_stub_call_count non-regression-guard counter
|
||||
* itself increments correctly. Task 4.2 owns the fuller "stays at zero
|
||||
* across a real production replication drive" assertion. */
|
||||
RUN_TEST(test_4_1_send_append_entries_stub_call_count_increments);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue