Skip to content
Merged
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
25 changes: 25 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,28 @@ def tag_test_report(request, pytestconfig, testbed, duthost, record_testsuite_pr
record_testsuite_property("platform", duthost.facts["platform"])
record_testsuite_property("hwsku", duthost.facts["hwsku"])
record_testsuite_property("os_version", duthost.os_version)

@pytest.fixture(scope="module", autouse=True)
def disable_container_autorestart(duthost, request):
skip = False
for m in request.node.iter_markers():
if m.name == "enable_container_autorestart":
skip = True
break
if skip:
yield
return
container_autorestart_states = duthost.get_container_autorestart_states()
# Disable autorestart for all containers
logging.info("Disable container autorestart")
cmd_disable = "config feature autorestart {} disabled"
for name, state in container_autorestart_states.items():
if state == "enabled":
duthost.command(cmd_disable.format(name))
yield
# Recover autorestart states
logging.info("Recover container autorestart")
cmd_enable = "config feature autorestart {} enabled"
for name, state in container_autorestart_states.items():
if state == "enabled":
duthost.command(cmd_enable.format(name))