@@ -757,3 +757,43 @@ 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
780+
781+
782+ @pytest .mark .unit
783+ @pytest .mark .usefixtures ("reset_mt_config" )
784+ def test_onResponseTraceRoute_routing_none (capsys ):
785+ """Test that onResponseTraceRoute does not print error for ROUTING_APP with NONE errorReason."""
786+ iface = MeshInterface (noProto = True )
787+
788+ packet = {
789+ "decoded" : {
790+ "portnum" : "ROUTING_APP" ,
791+ "routing" : {"errorReason" : "NONE" },
792+ }
793+ }
794+
795+ iface .onResponseTraceRoute (packet )
796+
797+ assert iface ._acknowledgment .receivedTraceRoute is True
798+ out , _ = capsys .readouterr ()
799+ assert "Traceroute failed" not in out
0 commit comments