[tests] simplify check for mdns enable/disable output (#11664)

This commit is contained in:
Jonathan Hui
2025-07-01 22:10:00 -07:00
committed by GitHub
parent 68d603ef42
commit e47122e5bb
+4 -12
View File
@@ -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):