Files
hblink3/tests
Cort BuffingtonandClaude Opus 4.8 8b0f8906b1 reporting: per-repeater ping-loss quality metric (chronic connectivity)
Surfaces the case the retired warn light was a poor proxy for: a repeater that
stays connected but loses pings over time (lossy link -> choppy/dropped audio).

Server-side, at each received RPTPING we infer how many pings were lost in the
gap since the previous one, against a per-repeater self-calibrated cadence (so a
repeater that simply pings slower is not read as lossy). Received and missed
counts decay exponentially (PING_QUALITY_TAU, ~15 min) VU-meter style, so the
value reflects recent/chronic loss and rises/falls slowly. Exposed as PING_LOSS%
in each repeater's snapshot (rides the 60s resync -- it moves slowly, so that
cadence is fine); the dashboard shows '· N% ping loss' and ambers the callsign
past a threshold. History is keyed by radio id and survives reconnects, so a
flapping lossy repeater still accumulates a meaningful figure.

Tests: clean cadence -> 0%, slower cadence -> 0% (not mistaken for loss),
dropped pings -> clear loss. Verified live: real repeaters read 0%. 58 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 21:18:36 -05:00
..

Tests

Regression tests pinning the behavior of helpers extracted during the 2026 cleanup. They exist because a live OBP/HBP network with real DMR audio cannot be reproduced in a dev environment, so the routing helpers are validated in isolation instead.

  • test_acl.py — HBSYSTEM.dmrd_acl_check() (the shared master/peer ACL logic): PERMIT/DENY matching, per-timeslot scoping, and the once-per-stream drop logging.
  • test_lc.py — gen_lcs() and embed_lc() from bridge.py: Link Control generation and the DMR payload LC rewrite used by all four group-routing paths.

Running

From the repo root, using the project virtualenv (which has twisted, dmr_utils3, and bitarray):

venv/bin/python -m unittest discover -s tests -v

Pure stdlib unittest — no extra dependencies. They also run under pytest if you have it installed (venv/bin/python -m pytest tests).