test(ha-single-leader-role): sweep all COMMITTING fixtures to direct-PRIMARY contract (task 5.1)

This commit is contained in:
Rongsong Shen 2026-06-13 13:59:42 +00:00
parent 71ce41f486
commit 7f974e766b
11 changed files with 138 additions and 169 deletions

View file

@ -958,7 +958,6 @@ static void test_wal_catchup_entry_advances_applied_lsn(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* applied_lsn starts at 0 */
TEST_ASSERT_EQUAL_UINT64(0,
@ -1000,7 +999,6 @@ static void test_wal_catchup_entry_error_skipped_no_crash(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
atomic_store_explicit(&ha.applied_lsn, 10, memory_order_release);
@ -1034,7 +1032,6 @@ static void test_wal_catchup_entry_null_entry_no_crash(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* NULL entry — must not crash, must return error */
@ -1060,7 +1057,6 @@ static void test_wal_catchup_batch_advances_applied_lsn(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* applied_lsn starts at 0 */
@ -1113,7 +1109,6 @@ static void test_wal_catchup_partial_batch(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* Pre-set applied_lsn to 5 to verify monotonic advance */
@ -1162,7 +1157,6 @@ static void test_wal_catchup_batch_error_entry_skipped(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* Good entry at LSN 30, then a NULL pointer (simulates corrupt entry),
@ -1212,7 +1206,6 @@ static void test_wal_catchup_batch_zero_entries_fallback(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* n_entries == 0 → single-entry path from task 2.1 */
@ -1255,7 +1248,6 @@ static void test_wal_catchup_batch_256_entries(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* Allocate 256 sub-entries at consecutive LSNs starting at 1000 */
@ -1318,7 +1310,6 @@ static void test_wal_catchup_batch_applied_lsn_only_after_full_batch(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* Pre-set applied_lsn to a known value so we can distinguish partial
@ -1388,7 +1379,6 @@ static void test_nop_reply_carries_state_report(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* Set a known applied_lsn */
@ -1432,7 +1422,6 @@ static void test_nop_reply_zero_state_fresh_standby(void)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(&ha, &cfg, 0);
/* applied_lsn stays at 0; config_version_tag stays at 0 → no config yet */
@ -1747,7 +1736,6 @@ static void snap_recv_ha_init(ha_state_t *ha)
memset(&cfg, 0, sizeof(cfg));
cfg.heartbeat_timeout_ms = 10000;
cfg.election_timeout_ms = 1500;
cfg.committing_timeout_ms = 10000;
ha_init(ha, &cfg, 0);
}
@ -2177,7 +2165,6 @@ static void test_ctrlhello_no_repl_messages_enqueued(void)
memset(&hcfg, 0, sizeof(hcfg));
hcfg.heartbeat_timeout_ms = 10000;
hcfg.election_timeout_ms = 1500;
hcfg.committing_timeout_ms = 10000;
ha_init(&c.ha, &hcfg, 0);
c.ha.primary_ctrl_fd = -1;