feat(ha-config-bootstrap): implement bootstrap_config_if_needed() (task 5.3)
- Probe all peers: any tag>0 -> defer_config_fetch=true; all-zero -> proceed; none reachable -> exponential backoff 500ms->10s cap with WARN per attempt - Wire into myapp.c: before ha_wait_for_heartbeat_or_timeout() - Post-election: defer_config_fetch && CTRL_STANDBY -> fetch_config_from_primary() - INFO log for all three bootstrap outcomes (Req 10.2) - XCE_TESTING hook for probe mock; test_ha_bootstrap_support.c installs mock - 9/9 bootstrap tests GREEN, 141/141 full suite GREEN
This commit is contained in:
parent
0c4a0760d1
commit
ab174c8b06
6 changed files with 163 additions and 8 deletions
|
|
@ -133,6 +133,17 @@ char *sanitise_cn(const char *src, size_t maxlen);
|
|||
#ifdef XCE_TESTING
|
||||
#include <pthread.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* xce_probe_config_tag_hook: test-only injection point for bootstrap probing.
|
||||
* When non-NULL, bootstrap_config_if_needed() calls this instead of the real
|
||||
* xce_probe_config_tag(), allowing unit tests to return controlled tag values
|
||||
* without real network connections.
|
||||
* Set by test infrastructure (e.g. test_ha_bootstrap_support.c) before tests run.
|
||||
*/
|
||||
extern int (*xce_probe_config_tag_hook)(const char *host, uint16_t port,
|
||||
uint64_t *tag_out);
|
||||
|
||||
/*
|
||||
* load_primary_config_for_test: test-only wrapper that exercises the path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue