From 46979c1f8b719f13788df18b8368da54783135e7 Mon Sep 17 00:00:00 2001 From: Audric Date: Mon, 15 Jun 2026 16:34:18 +0200 Subject: [PATCH] test(routable): clarify return-path docs; drop dead test scaffolding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document both forward and return legs of the 263xx transit chain in topology.py ROUTABLE_REFLECTORS comment block, making clear that natlde's routable entry toward natlit is the return-path hop and that the natlit→leaf final hop is carried by peer-interest (not a routable entry). Add inline note on natlde's entry. Drop ROUTABLE_NAMES from topology.py (dead — test files define their own sorted() locals, matching the REFLECTOR_NAMES/TWIN_NAMES convention). Remove duplicate sys.path.insert and unused COMPOSE_FILE/TESTS_DIR constants from test_routable.py. Add clarifying comment above the per-peer routable/blacklist injection in generate_configs.py. Generated configs are byte-identical; no topology routing changes. --- tests/generate_configs.py | 4 ++++ tests/test_routable.py | 8 ++------ tests/topology.py | 27 ++++++++++++++++++++++----- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/tests/generate_configs.py b/tests/generate_configs.py index 015254b..dbfea17 100644 --- a/tests/generate_configs.py +++ b/tests/generate_configs.py @@ -64,6 +64,8 @@ def generate_reflector_conf(name: str) -> str: f"SECRET={secret}", f"REMOTE_PREFIX={T.prefix_str(peer['prefix'])}", ] + # Optional per-peer routable/blacklist (used only by the ROUTABLE_REFLECTORS + # topology; inert for the default mesh). routable = r.get("routable", {}).get(peer_name) if routable: lines.append(f"ROUTABLE_PREFIXES={','.join(routable)}") @@ -598,6 +600,8 @@ def generate_routable_reflector_conf(name: str) -> str: f"SECRET={secret}", f"REMOTE_PREFIX={T.prefix_str(peer['prefix'])}", ] + # Optional per-peer routable/blacklist (used only by the ROUTABLE_REFLECTORS + # topology; inert for the default mesh). routable = r.get("routable", {}).get(peer_name) if routable: lines.append(f"ROUTABLE_PREFIXES={','.join(routable)}") diff --git a/tests/test_routable.py b/tests/test_routable.py index 90ed8cd..62d6b61 100644 --- a/tests/test_routable.py +++ b/tests/test_routable.py @@ -33,7 +33,8 @@ from urllib.request import urlopen from urllib.error import URLError import json -# Reuse the V2 mock client and wire helpers from test_trunk.py +# Reuse the V2 mock client and wire helpers from test_trunk.py. +# Also ensures tests/ is on the path for topology import below. sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from test_trunk import ( # noqa: E402 ClientPeer, UDP_AUDIO, UDP_FLUSH, @@ -41,8 +42,6 @@ from test_trunk import ( # noqa: E402 CLIENT2_CALLSIGN, CLIENT2_PASSWORD, ) -# Ensure tests/ is on the path so topology can be imported -sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import topology as T # --------------------------------------------------------------------------- @@ -53,9 +52,6 @@ HOST = "127.0.0.1" ROUTABLE_NAMES = sorted(T.ROUTABLE_REFLECTORS) -COMPOSE_FILE = "docker-compose.routable.yml" -TESTS_DIR = os.path.dirname(os.path.abspath(__file__)) - def _http(name: str): return (HOST, T.routable_mapped_http_port(name)) diff --git a/tests/topology.py b/tests/topology.py index c17bab4..c097d91 100644 --- a/tests/topology.py +++ b/tests/topology.py @@ -308,11 +308,27 @@ def twin_trunks_for(name: str) -> list: # --------------------------------------------------------------------------- # Routable-prefix chain (isolated topology, used by test_routable.py only) # -# leaf 222100* --trunk--> natlit 222 --trunk--> natlde 262 --trunk--> far 263 +# leaf 222100 --trunk--> natlit 222 --trunk--> natlde 262 --trunk--> far 263 # -# `263` is a SIBLING of 222/262 (not nested), so it is unreachable without -# routable prefixes. The leaf uses "*" (default route to its only uplink); -# each backbone hop declares an explicit ROUTABLE_PREFIXES toward 263. +# `263` is a SIBLING prefix to 222/262 (not nested), so it is unreachable +# from leaf without explicit routable-prefix declarations. +# +# Forward path (leaf → far): +# leaf uses ROUTABLE_PREFIXES=* toward natlit — default-route all non-local +# TGs up the only uplink. +# natlit uses ROUTABLE_PREFIXES=263 toward natlde — transits 263xx onward. +# natlde→far is native: far owns 263, so no routable entry is needed. +# +# Return path (far → leaf): +# far→natlde is native (far originates, natlde accepts as trunk owner relay). +# natlde uses ROUTABLE_PREFIXES=263 toward natlit — transits 263xx back up. +# (This is the return-path hop; the entry points upstream, not downstream.) +# natlit→leaf final hop is carried by PEER-INTEREST: leaf's ROUTABLE_PREFIXES=* +# caused it to advertise interest in 263xx up to natlit via MsgPeerTgInterest, +# so natlit forwards via isPeerInterestedTG — no routable entry on natlit +# toward leaf is needed or correct. +# leaf ACCEPTS the return audio because its uplink has the `*` wildcard +# (matchesRoutable), not because leaf has a routable entry pointing at itself. # # blacklist on leaf's uplink vetoes TG 26307 exactly (test_02) while leaving # TG 26305 (test_01) unaffected — the two tests use distinct TG numbers. @@ -324,12 +340,13 @@ ROUTABLE_REFLECTORS = { "blacklist": {"natlit": "26307"}}, "natlit": {"prefix": ["222"], "trunk_port_base": 52000, "peers": ["leaf", "natlde"], "routable": {"natlde": ["263"]}}, + # return-path hop: ROUTABLE_PREFIXES=263 toward natlit transits 263xx back + # up the chain (far→natlde native; natlit→leaf via peer-interest, not routable) "natlde": {"prefix": ["262"], "trunk_port_base": 53000, "peers": ["natlit", "far"], "routable": {"natlit": ["263"]}}, "far": {"prefix": ["263"], "trunk_port_base": 54000, "peers": ["natlde"]}, } -ROUTABLE_NAMES = list(ROUTABLE_REFLECTORS.keys()) # ---------------------------------------------------------------------------