test: P3-1..P3-5 hardening tests — failover, redirect, WAL, GC, throughput baseline

13 new Unity tests in test_p3_hardening.c covering:
- P3-1: promote/demote cycle verifies role+term monotonicity and
        hooks_registered reset; heartbeat timeout sets failover_requested
- P3-2: ha_should_redirect/ha_no_primary_known corner cases for
        PRIMARY, STANDBY-no-primary, STANDBY-with-primary
- P3-3: torn-write recovery after checkpoint (mixed WAL types, exact
        offset truncation); CRC corruption stops replay in mixed-type WAL
- P3-4: 1000 async WAL writes complete in < 5 s (throughput floor)
- P3-5: GC retention predicates — running retained, expired EXIT
        cleaned, TRANSIENT timeout, expired UNAVAIL worker cleaned,
        recent DONE retained

No new implementation code. All called functions existed from P0-P2.
This commit is contained in:
Rongsong Shen 2026-05-07 23:39:11 +00:00
parent 6bae7b382c
commit 1f97aee1a3
3 changed files with 508 additions and 0 deletions

View file

@ -93,6 +93,7 @@ controller_unit_test_src = [
'testsuite/test_persist_repl.c',
'testsuite/test_repl_catchup.c',
'testsuite/test_p2_integration.c',
'testsuite/test_p3_hardening.c',
'persist.c',
'ha.c',
'repl.c',