Skip to content

Commit d41d228

Browse files
congh-nvidiaztan-amd
authored andcommitted
Stabilize test_reload_dpu.py (sonic-net#21782)
Enhancement is for the switch memory exhaustion and kernel panic test cases. 1. Increase DUT_ABSENT_TIMEOUT_FOR_MEMORY_EXHAUSTION as it takes time to exhaust the memory. 2. Fail the test if the wait_for ssh shutdown fails. 3. Use a shorter retry delay in the common method ssh_connection_with_retry. The check happens after the delay, if the delay is bigger than the timeout, this wait_for always fails. See ansible document: https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/wait_for_module.html. Signed-off-by: Cong Hou <congh@nvidia.com> Signed-off-by: Zhuohui Tan <zhuohui.tan@amd.com>
1 parent 1ec674f commit d41d228

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

tests/common/reboot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,8 @@ def ssh_connection_with_retry(localhost, host_ip, port, delay, timeout):
736736
'search_regex': SONIC_SSH_REGEX
737737
}
738738
short_timeout = 40
739-
params_to_update_list = [{}, {'search_regex': None, 'timeout': short_timeout}]
739+
short_delay = 10
740+
params_to_update_list = [{}, {'search_regex': None, 'timeout': short_timeout, 'delay': short_delay}]
740741
for num_try, params_to_update in enumerate(params_to_update_list):
741742
iter_connection_params = default_connection_params.copy()
742743
iter_connection_params.update(params_to_update)

tests/smartswitch/platform_tests/test_reload_dpu.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
kernel_panic_cmd = "sudo nohup bash -c 'sleep 5 && echo c > /proc/sysrq-trigger' &"
2525
memory_exhaustion_cmd = "sudo nohup bash -c 'sleep 5 && tail /dev/zero' &"
2626
DUT_ABSENT_TIMEOUT_FOR_KERNEL_PANIC = 100
27-
DUT_ABSENT_TIMEOUT_FOR_MEMORY_EXHAUSTION = 100
27+
DUT_ABSENT_TIMEOUT_FOR_MEMORY_EXHAUSTION = 240
2828
MAX_COOL_OFF_TIME = 300
2929

3030

@@ -121,8 +121,7 @@ def test_dpu_status_post_switch_mem_exhaustion(duthosts, dpuhosts,
121121
state='absent',
122122
search_regex=SONIC_SSH_REGEX,
123123
delay=10,
124-
timeout=DUT_ABSENT_TIMEOUT_FOR_MEMORY_EXHAUSTION,
125-
module_ignore_errors=True)
124+
timeout=DUT_ABSENT_TIMEOUT_FOR_MEMORY_EXHAUSTION)
126125

127126
logging.info("Executing post test check")
128127
post_test_switch_check(duthost, localhost,
@@ -164,8 +163,7 @@ def test_dpu_status_post_switch_kernel_panic(duthosts, dpuhosts,
164163
state='absent',
165164
search_regex=SONIC_SSH_REGEX,
166165
delay=10,
167-
timeout=DUT_ABSENT_TIMEOUT_FOR_KERNEL_PANIC,
168-
module_ignore_errors=True)
166+
timeout=DUT_ABSENT_TIMEOUT_FOR_KERNEL_PANIC)
169167

170168
logging.info("Executing post test check")
171169
post_test_switch_check(duthost, localhost,

0 commit comments

Comments
 (0)