fix(server): honour the legacy thresholds: config; repair the stale test suite
Since the built-in defaults were seeded into threshold_configs, the legacy top-level thresholds: format was silently ignored. get_thresholds_for_host now uses it whenever it was configured. Tests: point imports at hbd.server/hbd.common, rewrite the DNS worker, proto, datagram and threshold tests for the current API, add pytest-asyncio to the dev extras and set testpaths so a bare pytest runs cleanly. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+8
-8
@@ -1,19 +1,19 @@
|
||||
from hbd.proto import dicttos, stodict, oldmtodict
|
||||
from hbd.common.proto import dicttos, stodict, oldmtodict
|
||||
|
||||
|
||||
def test_dicttos_and_stodict_uncompressed():
|
||||
def test_dicttos_and_stodict_roundtrip():
|
||||
msg = dicttos("HTB", {"name": "host.example", "interval": 10})
|
||||
assert msg.startswith(b"!HTB:")
|
||||
d = stodict(msg)
|
||||
assert d["ID"].startswith("HTB")
|
||||
assert d["ID"] == "HTB"
|
||||
assert d["name"] == "host.example"
|
||||
assert d["interval"] == 10
|
||||
|
||||
|
||||
def test_dicttos_and_stodict_compressed():
|
||||
msg = dicttos("ACK", {"time": 12345}, compress=True)
|
||||
d = stodict(msg)
|
||||
# for compressed the original code included the colon in ID slice; ensure no crash
|
||||
assert "ID" in d
|
||||
def test_dicttos_and_stodict_ack():
|
||||
d = stodict(dicttos("ACK", {"time": 12345}))
|
||||
assert d["ID"] == "ACK"
|
||||
assert d["time"] == 12345
|
||||
|
||||
|
||||
def test_oldmtodict():
|
||||
|
||||
Reference in New Issue
Block a user