From e47122e5bb2786101ae358008c51169604b4bca1 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Tue, 1 Jul 2025 22:10:00 -0700 Subject: [PATCH] [tests] simplify check for mdns enable/disable output (#11664) --- tests/scripts/thread-cert/node.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/scripts/thread-cert/node.py b/tests/scripts/thread-cert/node.py index 97d70b822..b153fb02f 100755 --- a/tests/scripts/thread-cert/node.py +++ b/tests/scripts/thread-cert/node.py @@ -178,22 +178,14 @@ class OtbrDocker: def stop_mdns_service(self): self.send_command('mdns disable') - # The OT build may not include mdns, so ignore `InvalidCommand` errors. - try: - self._expect_result(r'Done') - except Exception as ex: - if 'InvalidCommand' not in str(ex): - raise + # OT build may not include mdns, so ignore `InvalidCommand` errors. + self._expect(r'Done|Error 35: InvalidCommand') self.bash('service avahi-daemon stop; service mdns stop; !(cat /proc/net/udp | grep -i :14E9)') def start_mdns_service(self): self.send_command('mdns enable') - # The OT build may not include mdns, so ignore `InvalidCommand` errors. - try: - self._expect_result(r'Done') - except Exception as ex: - if 'InvalidCommand' not in str(ex): - raise + # OT build may not include mdns, so ignore `InvalidCommand` errors. + self._expect(r'Done|Error 35: InvalidCommand') self.bash('service avahi-daemon start; service mdns start; cat /proc/net/udp | grep -i :14E9') def start_ot_ctl(self):