mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
fix(ci): restart avahi-daemon in otbr service discovery test case
This commit is contained in:
parent
ec990f4a52
commit
508cb1f97d
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
# !/usr/bin/env python3
|
||||
# this file defines some functions for testing cli and br under pytest framework
|
||||
@ -408,20 +408,21 @@ def get_host_ipv4_address() -> str:
|
||||
return host_ipv4_address
|
||||
|
||||
|
||||
def start_avahi() -> None:
|
||||
time.sleep(1)
|
||||
command = '/etc/init.d/dbus start'
|
||||
def restart_avahi() -> None:
|
||||
command = 'avahi-daemon -k'
|
||||
subprocess.Popen(command, shell=True)
|
||||
time.sleep(5)
|
||||
time.sleep(2)
|
||||
command = 'avahi-daemon'
|
||||
subprocess.Popen(command, shell=True)
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
def host_publish_service() -> None:
|
||||
command = 'avahi-publish-service testxxx _testxxx._udp 12347 test=1235 dn="for_ci_br_test"'
|
||||
def start_avahi() -> None:
|
||||
time.sleep(1)
|
||||
command = '/etc/init.d/dbus start'
|
||||
subprocess.Popen(command, shell=True)
|
||||
time.sleep(2)
|
||||
time.sleep(5)
|
||||
restart_avahi()
|
||||
|
||||
|
||||
def host_close_service() -> None:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
# !/usr/bin/env python3
|
||||
import copy
|
||||
@ -447,7 +447,10 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
|
||||
command = 'dns browse _testxxx._udp.default.service.arpa'
|
||||
tmp = ocf.get_ouput_string(cli, command, 5)
|
||||
assert 'Port:12347' not in str(tmp)
|
||||
ocf.host_publish_service()
|
||||
ocf.restart_avahi()
|
||||
command = 'avahi-publish-service testxxx _testxxx._udp 12347 test=1235 dn="for_ci_br_test"'
|
||||
sp = subprocess.Popen(command, shell=True)
|
||||
time.sleep(2)
|
||||
ocf.wait(cli, 5)
|
||||
|
||||
command = 'dns browse _testxxx._udp.default.service.arpa'
|
||||
@ -455,14 +458,13 @@ def test_service_discovery_of_WiFi_device(Init_interface:bool, Init_avahi:bool,
|
||||
assert 'response for _testxxx' in str(tmp)
|
||||
assert 'Port:12347' in str(tmp)
|
||||
|
||||
command = 'dns browse _testxxx._udp.default.service.arpa'
|
||||
command = 'dns service testxxx _testxxx._udp.default.service.arpa.'
|
||||
tmp = ocf.get_ouput_string(cli, command, 5)
|
||||
ocf.execute_command(cli, 'dns service testxxx _testxxx._udp.default.service.arpa.')
|
||||
tmp = cli.expect(pexpect.TIMEOUT, timeout=5)
|
||||
assert 'response for testxxx' in str(tmp)
|
||||
assert 'Port:12347' in str(tmp)
|
||||
finally:
|
||||
ocf.host_close_service()
|
||||
sp.terminate()
|
||||
ocf.execute_command(br, 'factoryreset')
|
||||
ocf.execute_command(cli, 'factoryreset')
|
||||
time.sleep(3)
|
||||
|
Loading…
x
Reference in New Issue
Block a user