fix: never park the last present family as absent
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uc9V1v7iXruubpoLiSE24M
This commit is contained in:
@@ -217,3 +217,34 @@ def test_v4_only_host_overdue_is_single_critical(monkeypatch):
|
||||
assert "connectivity.IPv4" in h.alert_states
|
||||
asyncio.run(on_overdue(h.connections["IPv4"]))
|
||||
assert len([e for e in events if e[0] == "CRITICAL"]) == 1
|
||||
|
||||
|
||||
def test_all_families_absent_v4_only_host_still_alerts_when_it_dies(monkeypatch):
|
||||
events = _events(monkeypatch)
|
||||
ctx = _ctx()
|
||||
_fresh("pres-allabsent")
|
||||
_send("pres-allabsent", "127.0.0.1", ctx, p4=0)
|
||||
h = hbdclass.Host.hosts["pres-allabsent"]
|
||||
on_overdue, _ = udp._make_timer_callbacks("pres-allabsent", h, ctx)
|
||||
asyncio.run(on_overdue(h.connections["IPv4"]))
|
||||
assert [e for e in events if e[0] == "CRITICAL"] == [("CRITICAL", "IPv4 overdue")]
|
||||
assert h.connections["IPv4"].state == C.OVERDUE
|
||||
assert h.status() == "overdue"
|
||||
assert "connectivity.IPv4" in h.alert_states
|
||||
|
||||
|
||||
def test_last_present_family_is_not_parked_when_other_is_absent(monkeypatch):
|
||||
events = _events(monkeypatch)
|
||||
ctx = _ctx()
|
||||
h = _dual_stack("pres-lastfam", ctx)
|
||||
_send("pres-lastfam", "127.0.0.1", ctx, p4=0, p6=0)
|
||||
events.clear()
|
||||
on_overdue, _ = udp._make_timer_callbacks("pres-lastfam", h, ctx)
|
||||
asyncio.run(on_overdue(h.connections["IPv4"]))
|
||||
assert h.connections["IPv4"].state == C.ABSENT
|
||||
assert not any(level == "CRITICAL" for level, _ in events)
|
||||
assert h.status() == "up"
|
||||
asyncio.run(on_overdue(h.connections["IPv6"]))
|
||||
assert [e for e in events if e[0] == "CRITICAL"] == [("CRITICAL", "IPv6 overdue")]
|
||||
assert h.connections["IPv6"].state == C.OVERDUE
|
||||
assert h.status() == "overdue"
|
||||
|
||||
Reference in New Issue
Block a user