headscale/hscontrol/state
Kristoffer Dalby e2f2f9211f state, servertest: property-test HA election + invariant catalogue
Expand TestPrimaryRoutesProperty (5 -> 9 ops). New ops mirror the
production shapes the failure cases hit: BatchProbeResults via
UpdateNodes, SimultaneousDisconnect via UpdateNodes, SetApprovedRoutes
that leaves announced RoutableIPs intact, OfflineExpiry that keeps
Unhealthy set. The model now tracks announced and approved separately
and recomputes the intersection.

Strengthen the per-op assertions to cover invariants the model alone
cannot prove: every primary must be online, every primary must
currently advertise its prefix, no flap onto an unhealthy candidate
when a healthy one was available, no flap off a previous primary that
remains a healthy candidate. The check now takes a pre-op snapshot so
the anti-flap rule has a stable reference.

Add TestHAProberProperty in servertest. It drives a real TestServer
with three HA-route-advertising clients through rapid-drawn sequences
of ClientDisconnect / ClientReconnect / ProberTick / WaitForSnapshot
ops and re-checks the same shape invariants after every step.

Document the system in hscontrol/state/HA_INVARIANTS.md: a state
machine over (Healthy+Online, Unhealthy+Online, Offline,
OfflineExpired), fifteen numbered invariants with predicates and
violation paths, and a coverage matrix mapping each invariant to its
unit, servertest, and integration tests. Three rows pin the recent
fixes to the invariants they enforce.
2026-05-18 17:18:08 +02:00
..
auth_cache_test.go state: replace zcache with bounded LRU for auth cache 2026-04-10 14:09:57 +01:00
debug.go state: switch consumers to NodeStore primary routes 2026-04-29 18:08:39 +01:00
debug_test.go hscontrol/state: make NodeStore batch configuration tunable (#2886) 2025-11-28 16:38:29 +01:00
endpoint_test.go hscontrol/state: make NodeStore batch configuration tunable (#2886) 2025-11-28 16:38:29 +01:00
ephemeral_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
ha_health.go state: batch HA probe results so dual-disconnect cannot flap primary 2026-05-18 17:18:08 +02:00
maprequest.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
maprequest_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
node_store.go state, servertest: property-test HA election + invariant catalogue 2026-05-18 17:18:08 +02:00
node_store_hostname_test.go state: auto-bump GivenName on collision and add SetGivenName 2026-04-18 15:12:21 +01:00
node_store_test.go types: persist Node JSON slices via named IsZero types 2026-05-15 11:21:58 +02:00
persist_test.go state: add regression test for Node slice persistence 2026-05-15 11:21:58 +02:00
ping.go state: drain pending pings on Close 2026-04-17 16:31:49 +01:00
ping_test.go state: drain pending pings on Close 2026-04-17 16:31:49 +01:00
primaries_property_test.go state, servertest: property-test HA election + invariant catalogue 2026-05-18 17:18:08 +02:00
primaries_test.go state, servertest: property-test HA election + invariant catalogue 2026-05-18 17:18:08 +02:00
ssh_check_test.go state, policy, noise: implement SSH check period auto-approval 2026-02-25 21:28:05 +01:00
state.go state: batch HA probe results so dual-disconnect cannot flap primary 2026-05-18 17:18:08 +02:00
tags.go hscontrol: enforce that tagged nodes never have user_id 2026-02-20 21:51:00 +01:00
test_helpers.go hscontrol/state: make NodeStore batch configuration tunable (#2886) 2025-11-28 16:38:29 +01:00