Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cherry pick master PR] Improvising pre_checks for test_reload config #8843

Merged
merged 5 commits into from
Jul 7, 2023
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
9 changes: 5 additions & 4 deletions tests/common/reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def execute_reboot_helper():

def reboot(duthost, localhost, reboot_type='cold', delay=10,
timeout=0, wait=0, wait_for_ssh=True, wait_warmboot_finalizer=False, warmboot_finalizer_timeout=0,
reboot_helper=None, reboot_kwargs=None):
reboot_helper=None, reboot_kwargs=None, plt_reboot_ctrl_overwrite=True):
"""
reboots DUT
:param duthost: DUT host object
Expand All @@ -221,9 +221,10 @@ def reboot(duthost, localhost, reboot_type='cold', delay=10,
timeout = reboot_ctrl['timeout']
if wait == 0:
wait = reboot_ctrl['wait']
if plt_reboot_ctrl:
wait = plt_reboot_ctrl['wait']
timeout = plt_reboot_ctrl['timeout']
if plt_reboot_ctrl_overwrite and plt_reboot_ctrl:
# get 'wait' and 'timeout' from inventory if they are specified, otherwise use current values
wait = plt_reboot_ctrl.get('wait', wait)
timeout = plt_reboot_ctrl.get('timeout', timeout)
if warmboot_finalizer_timeout == 0 and 'warmboot_finalizer_timeout' in reboot_ctrl:
warmboot_finalizer_timeout = reboot_ctrl['warmboot_finalizer_timeout']
except KeyError:
Expand Down
13 changes: 10 additions & 3 deletions tests/platform_tests/test_reload_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
pytest.mark.topology('any')
]

def test_reload_configuration(duthosts, rand_one_dut_hostname, conn_graph_facts, xcvr_skip_list):
def test_reload_configuration(duthosts, enum_rand_one_per_hwsku_hostname,
conn_graph_facts, xcvr_skip_list):
"""
@summary: This test case is to reload the configuration and check platform status
"""
Expand Down Expand Up @@ -75,7 +76,8 @@ def check_database_status(duthost):

return True

def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, localhost, conn_graph_facts, xcvr_skip_list):
def test_reload_configuration_checks(duthosts, enum_rand_one_per_hwsku_hostname,
localhost, conn_graph_facts, xcvr_skip_list):
"""
@summary: This test case is to test various system checks in config reload
"""
Expand All @@ -84,7 +86,8 @@ def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, localhost,
if not config_force_option_supported(duthost):
return

reboot(duthost, localhost, reboot_type="cold", wait=5)
reboot(duthost, localhost, reboot_type="cold", wait=5,
plt_reboot_ctrl_overwrite=False)

# Check if all database containers have started
wait_until(60, 1, 0, check_database_status, duthost)
Expand All @@ -104,6 +107,10 @@ def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, localhost,

# Immediately after one config reload command, another shouldn't execute and wait for system checks
logging.info("Checking config reload after system is up")
# Check if all database containers have started
wait_until(60, 1, 0, check_database_status, duthost)
# Check if interfaces-config.service is exited
wait_until(60, 1, 0, check_interfaces_config_service_status, duthost)
out = duthost.shell("sudo config reload -y", executable="/bin/bash", module_ignore_errors=True)
assert "Retry later" in out['stdout']
assert wait_until(300, 20, 0, config_system_checks_passed, duthost)
Expand Down