From c55f3a19e927c97daa2714fb940809d16fd966e4 Mon Sep 17 00:00:00 2001 From: l5y <220195275+l5yth@users.noreply.github.com> Date: Wed, 19 Nov 2025 17:03:46 +0100 Subject: [PATCH] subscribe to traceroute app pubsub topic (#471) * subscribe to traceroute app pubsub topic * cover missing unit test vectors --- data/mesh_ingestor/daemon.py | 1 + tests/test_mesh.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/data/mesh_ingestor/daemon.py b/data/mesh_ingestor/daemon.py index 1be0c03..86cfdc9 100644 --- a/data/mesh_ingestor/daemon.py +++ b/data/mesh_ingestor/daemon.py @@ -36,6 +36,7 @@ _RECEIVE_TOPICS = ( "meshtastic.receive.TEXT_MESSAGE_APP", "meshtastic.receive.REACTION_APP", "meshtastic.receive.TELEMETRY_APP", + "meshtastic.receive.TRACEROUTE_APP", ) diff --git a/tests/test_mesh.py b/tests/test_mesh.py index 79c5c68..e83e853 100644 --- a/tests/test_mesh.py +++ b/tests/test_mesh.py @@ -224,6 +224,30 @@ def mesh_module(monkeypatch): sys.modules.pop(module_name, None) +def test_subscribe_receive_topics_covers_all_handlers(mesh_module, monkeypatch): + mesh = mesh_module + daemon_mod = sys.modules["data.mesh_ingestor.daemon"] + + recorded_calls: list[tuple[tuple[object, ...], dict[str, object]]] = [] + + class RecordingPub: + def subscribe(self, *args, **kwargs): + recorded_calls.append((args, kwargs)) + + monkeypatch.setattr(daemon_mod, "pub", RecordingPub()) + + subscribed_topics = mesh._subscribe_receive_topics() + + expected_topics = list(mesh._RECEIVE_TOPICS) + assert subscribed_topics == expected_topics + assert len(recorded_calls) == len(expected_topics) + + for (args, kwargs), topic in zip(recorded_calls, expected_topics): + assert not kwargs + assert args[0] is mesh.on_receive + assert args[1] == topic + + def test_snapshot_interval_defaults_to_60_seconds(mesh_module): mesh = mesh_module assert mesh.SNAPSHOT_SECS == 60