test(ha-commit-barrier-rollout): RED tests for config barrier (task 5.1)

6 RED carriers pinning the three configAck defects (previous-tag acks
count, n_active==0 success shortcut, no-self-count denominator) and the
push/upgrade failure path (logged-only result, unconditional success
ACK + restart). 2 sanctioned pins (single-member, success-unchanged).
Behavior-preserving signature change: push_config_to_standbys gains
acked_out (return still legacy push count; 7 call sites NULL'd,
body-diff verified). 29/6 in group; no collateral failures.
This commit is contained in:
Rongsong Shen 2026-06-12 16:31:42 +00:00
parent 732e836868
commit 9cdeba5816
9 changed files with 582 additions and 19 deletions

View file

@ -13,9 +13,16 @@
* confirmation advances committed_lsn through the engine. They are RED
* against the unwired legacy counting (`acked_lsn > 0`, n_active
* denominator, zero-active success short-circuit) and go green with tasks
* 5.2/5.3. The configAck expectations are untouched (config barrier is
* owned by ha-commit-barrier-rollout); only the mechanical entry_lsn=0
* argument was added to the call.
* 5.2/5.3.
*
* ha-commit-barrier-rollout task 5.1: the configAck case now follows the
* per-push arithmetic (design §Config Barrier): the call passes the config
* PUSH TAG as entry_lsn (no longer a vacuous 0 — the hardened branch counts
* standbys with acked_config_lsn >= push_tag, majority 1 (self) + count >
* n_peers / 2 over configured members). The expectation below (-ETIMEDOUT
* with zero covering acks) holds under BOTH the legacy counting and the
* per-push arithmetic; the RED carriers for the arithmetic change live in
* test_commit_barrier_rollout.c (task 5.1 section).
*
* Requirements: ha-commit-engine 1.1, 1.2, 2.1, 4.2, 4.4, 6.3
* (original repl coverage: 5.1, 5.4, 5.5, 5.8, 8.2)
@ -213,8 +220,11 @@ static void test_wait_majority_ack_catchup_excluded_from_quorum(void)
}
/* ── Test 5: OP_walAck vs OP_upgradeConfigAck dispatched independently ─────
* walAck half is engine-wired per-LSN; the configAck expectation is
* byte-identical legacy behavior (config barrier owned downstream). */
* walAck half is engine-wired per-LSN; the configAck half passes a real
* push tag as entry_lsn (per-push arithmetic, barrier-rollout task 5.1):
* n_peers=2, one active standby with NO covering config ack → timeout under
* both the legacy counting (acked_config_lsn 0, not > 0) and the hardened
* arithmetic (count(acked_config_lsn >= tag) = 0; 1 + 0 > 2/2 is false). */
static struct ack_args g_a5_0;
static void test_wait_majority_ack_ack_op_discriminates(void)
@ -233,8 +243,9 @@ static void test_wait_majority_ack_ack_op_discriminates(void)
TEST_ASSERT_EQUAL_UINT64_MESSAGE(1, m_committed(),
"walAck confirmation must advance committed_lsn per-LSN");
/* upgradeConfigAck with no pending ACKs → timeout */
int rc_cfg = repl_wait_majority_ack(&g_mp.repl, 0, 50,
/* upgradeConfigAck for push tag 0xC0FFEE with no covering config ACKs
* → timeout (entry_lsn carries the push tag — per-push arithmetic) */
int rc_cfg = repl_wait_majority_ack(&g_mp.repl, 0xC0FFEE, 50,
(uint8_t)OPCode_upgradeConfigAck);
TEST_ASSERT_EQUAL_INT(-ETIMEDOUT, rc_cfg);