test(ha-config-bootstrap): add failing dispatch gate tests (task 3.1)

RED-phase tests for ha_dispatch_gate() and FSM init state:
- CTRL_INIT + non-election ops -> XCE_ERR_NOT_READY
- CTRL_INIT/ELECTING + OP_requestVote/OP_probeConfigTag -> 0 (allowed)
- CTRL_STANDBY + primary-only ops -> XCE_ERR_STANDBY
- CTRL_PRIMARY + any op -> 0
- heartbeat_seen semaphore usable after ha_init()

ha_dispatch_gate, XCE_ERR_NOT_READY, XCE_ERR_STANDBY are all undefined
-> linker errors confirm RED phase
This commit is contained in:
Rongsong Shen 2026-05-28 04:42:30 +00:00
parent 488fd1bf49
commit 0a881804a0
2 changed files with 234 additions and 9 deletions

View file

@ -54,7 +54,7 @@ Dependency order: startup validation (D) unblocks vtaskmgr before election (A);
- _Boundary: Startup Validation (main.c, ha.c)_
- [ ] 3. Change A: Listener and iomgr/vtaskmgr before election
- [ ] 3.1 Write failing tests for dispatch gate and FSM init state
- [x] 3.1 Write failing tests for dispatch gate and FSM init state
- In `src/controller/testsuite/test_ha_startup.c` (extend): test that requests other than `OP_requestVote` and `OP_probeConfigTag` receive `XCE_ERR_NOT_READY` when role is `CTRL_INIT`; test `CTRL_STANDBY` returns `XCE_ERR_STANDBY` for primary-only ops; test `heartbeat_seen` semaphore initialized in `ha_init()`
- `make test` fails
- _Requirements: 1.1, 1.2, 1.3, 1.4_