Skip to content

Commit c71d3df

Browse files
Add unit test for onResponseTraceRoute ROUTING_APP error handling
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0413d00 commit c71d3df

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

meshtastic/tests/test_mesh_interface.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,3 +757,23 @@ def test_timeago_fuzz(seconds):
757757
"""Fuzz _timeago to ensure it works with any integer"""
758758
val = _timeago(seconds)
759759
assert re.match(r"(now|\d+ (secs?|mins?|hours?|days?|months?|years?))", val)
760+
761+
762+
@pytest.mark.unit
763+
@pytest.mark.usefixtures("reset_mt_config")
764+
def test_onResponseTraceRoute_routing_error(capsys):
765+
"""Test that onResponseTraceRoute handles ROUTING_APP error packets correctly."""
766+
iface = MeshInterface(noProto=True)
767+
768+
packet = {
769+
"decoded": {
770+
"portnum": "ROUTING_APP",
771+
"routing": {"errorReason": "MAX_RETRANSMIT"},
772+
}
773+
}
774+
775+
iface.onResponseTraceRoute(packet)
776+
777+
assert iface._acknowledgment.receivedTraceRoute is True
778+
out, _ = capsys.readouterr()
779+
assert "Traceroute failed: MAX_RETRANSMIT" in out

0 commit comments

Comments
 (0)