Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,41 @@ def _remove_entry(table_name, key_name, config):
add_custom_msg(request, f"{DUT_CHECK_NAMESPACE}.config_db_check_pass", config_db_check_pass)


@pytest.fixture(scope="module", autouse=True)
def temporarily_disable_route_check(request, duthosts):
check_flag = False
for m in request.node.iter_markers():
if m.name == "disable_route_check":
check_flag = True
break

def run_route_check(dut):
rc = dut.shell("sudo route_check.py", module_ignore_errors=True)
if rc['rc'] != 0:
pytest.fail("route_check.py failed on DUT {} in test setup/teardown stage".format(dut.hostname))

if check_flag:
with SafeThreadPoolExecutor(max_workers=8) as executor:
for duthost in duthosts.frontend_nodes:
executor.submit(run_route_check, duthost)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for duthost in duthosts.frontend_nodes:
executor.submit(duthost.shell, "sudo monit stop routeCheck")

yield

if check_flag:
try:
with SafeThreadPoolExecutor(max_workers=8) as executor:
for duthost in duthosts.frontend_nodes:
executor.submit(run_route_check, duthost)
finally:
with SafeThreadPoolExecutor(max_workers=8) as executor:
for duthost in duthosts.frontend_nodes:
executor.submit(duthost.shell, "sudo monit start routeCheck")


@pytest.fixture(scope="function")
def on_exit():
'''
Expand Down
1 change: 1 addition & 0 deletions tests/platform_tests/link_flap/test_cont_link_flap.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from tests.common.platform.device_utils import toggle_one_link

pytestmark = [
pytest.mark.disable_route_check,
pytest.mark.disable_loganalyzer,
pytest.mark.topology('any')
]
Expand Down
Loading