test(ha-config-bootstrap): add failing startup validation tests (task 2.1)

RED-phase tests for 4 startup validation functions — all fail at link time
because the functions under test do not exist yet:
- validate_peer_count: even N>1 returns -EINVAL, odd N returns 0
- validate_cert_files: missing cert/key returns -ENOENT with full path
  in err_buf output param (asserted via strstr)
- validate_vcpus: vcpus<=0 returns -EINVAL, positive returns 0
- validate_startup_config: vcpus key in config returns 0 (not fatal)
  and writes deprecation text into warn_buf (asserted via strstr)
This commit is contained in:
Rongsong Shen 2026-05-28 03:31:30 +00:00
parent 560d8fa1c8
commit bfa41eb135
4 changed files with 248 additions and 1 deletions

View file

@ -31,7 +31,7 @@ Dependency order: startup validation (D) unblocks vtaskmgr before election (A);
- _Boundary: Controller FSM (ha.h)_
- [ ] 2. Change D: Startup validation and ASAN fix
- [ ] 2.1 Write failing tests for startup validation
- [x] 2.1 Write failing tests for startup validation
- In `src/controller/testsuite/test_ha_startup.c`: test even-N peer count returns `-EINVAL`; test cert missing returns `-ENOENT` with full path in message; test `--vcpus 0` returns `-EINVAL`; test `vcpus` key in config file logs WARN but does not fail
- `make test` fails (functions under test do not exist yet)
- _Requirements: 4.1, 4.2, 4.3, 4.4_