From eca3c71122bb55433d80150e96eee21837353db2 Mon Sep 17 00:00:00 2001 From: Audric Date: Fri, 27 Mar 2026 15:19:13 +0100 Subject: [PATCH] Fix TG number substring match in log grep and remove debug logging The interactive tester's log parser matched "TG #1" as a substring of "TG #12001", "TG #10", etc., causing false positives for short TG numbers. Use a regex negative lookahead (?!\d) so "TG #1" only matches when not followed by another digit. Same fix applied to test_15 satellite routing. Also remove debug logging accidentally left in TrunkLink::onLocalTalkerStart. --- tests/test_trunk.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_trunk.py b/tests/test_trunk.py index eb18785..93f7d72 100644 --- a/tests/test_trunk.py +++ b/tests/test_trunk.py @@ -14,6 +14,7 @@ import hashlib import hmac import json import os +import re import socket import struct import sys @@ -1069,8 +1070,8 @@ class TestTrunkIntegration(unittest.TestCase): # Check logs on the other reflector for trunk talker svc = T.service_name(other) lines = docker_log_lines(svc, since_lines=30) - found = any(f"Trunk talker start on TG #{tg}" in line - for line in lines) + pat = re.compile(rf"Trunk talker start on TG #{tg}(?!\d)") + found = any(pat.search(line) for line in lines) self.assertTrue(found, f"reflector-{other} did not receive trunk talker for TG {tg} " f"from satellite via parent") @@ -1294,8 +1295,9 @@ def interactive_loop(): lines = docker_log_lines(svc, since_lines=30) events = [] + tg_pattern = re.compile(rf"TG #{tg_str}(?!\d)") for line in lines: - if f"TG #{tg_str}" not in line: + if not tg_pattern.search(line): continue # Extract the event part after the container prefix parts = line.split("|", 1)