Skip to content

Commit 47f3a0b

Browse files
authored
[cherry pick master PR] Improvising pre_checks for test_reload config (#8843)
Description of PR This is cherry-pick of #7953 * Update multi_asic.py * Update sonic.py * added flag plt_reboot_ctrl_overwrite in reboot function to decide whether we want to overwrite wait and timeout. added a flag plt_reboot_ctrl_overwrite in reboot function to decide whether we want to overwrite wait and timeout. by default is to overwrite, in this test test_reload_configuration_checks we don't want to wait for that long, we want to catch transient error, so the flag is False. * changed to run on every sku with enum_rand_one_per_hwsku_hostname co-authorized by: [email protected]
1 parent 820e16c commit 47f3a0b

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

tests/common/reboot.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def execute_reboot_helper():
195195

196196
def reboot(duthost, localhost, reboot_type='cold', delay=10,
197197
timeout=0, wait=0, wait_for_ssh=True, wait_warmboot_finalizer=False, warmboot_finalizer_timeout=0,
198-
reboot_helper=None, reboot_kwargs=None):
198+
reboot_helper=None, reboot_kwargs=None, plt_reboot_ctrl_overwrite=True):
199199
"""
200200
reboots DUT
201201
:param duthost: DUT host object
@@ -221,9 +221,10 @@ def reboot(duthost, localhost, reboot_type='cold', delay=10,
221221
timeout = reboot_ctrl['timeout']
222222
if wait == 0:
223223
wait = reboot_ctrl['wait']
224-
if plt_reboot_ctrl:
225-
wait = plt_reboot_ctrl['wait']
226-
timeout = plt_reboot_ctrl['timeout']
224+
if plt_reboot_ctrl_overwrite and plt_reboot_ctrl:
225+
# get 'wait' and 'timeout' from inventory if they are specified, otherwise use current values
226+
wait = plt_reboot_ctrl.get('wait', wait)
227+
timeout = plt_reboot_ctrl.get('timeout', timeout)
227228
if warmboot_finalizer_timeout == 0 and 'warmboot_finalizer_timeout' in reboot_ctrl:
228229
warmboot_finalizer_timeout = reboot_ctrl['warmboot_finalizer_timeout']
229230
except KeyError:

tests/platform_tests/test_reload_config.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
pytest.mark.topology('any')
2323
]
2424

25-
def test_reload_configuration(duthosts, rand_one_dut_hostname, conn_graph_facts, xcvr_skip_list):
25+
def test_reload_configuration(duthosts, enum_rand_one_per_hwsku_hostname,
26+
conn_graph_facts, xcvr_skip_list):
2627
"""
2728
@summary: This test case is to reload the configuration and check platform status
2829
"""
@@ -75,7 +76,8 @@ def check_database_status(duthost):
7576

7677
return True
7778

78-
def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, localhost, conn_graph_facts, xcvr_skip_list):
79+
def test_reload_configuration_checks(duthosts, enum_rand_one_per_hwsku_hostname,
80+
localhost, conn_graph_facts, xcvr_skip_list):
7981
"""
8082
@summary: This test case is to test various system checks in config reload
8183
"""
@@ -84,7 +86,8 @@ def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, localhost,
8486
if not config_force_option_supported(duthost):
8587
return
8688

87-
reboot(duthost, localhost, reboot_type="cold", wait=5)
89+
reboot(duthost, localhost, reboot_type="cold", wait=5,
90+
plt_reboot_ctrl_overwrite=False)
8891

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

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

0 commit comments

Comments
 (0)