From 05c2a8c0d449d6f9f687991803dc05d6da215500 Mon Sep 17 00:00:00 2001 From: ansrajpu Date: Fri, 31 Mar 2023 17:09:14 -0400 Subject: [PATCH 1/6] Fix for test_config_reload.py_Retry later error within a short interval after reboot --- tests/common/reboot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/common/reboot.py b/tests/common/reboot.py index 23faf86890..7e5f2b2dc3 100644 --- a/tests/common/reboot.py +++ b/tests/common/reboot.py @@ -221,9 +221,9 @@ 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: + wait = plt_reboot_ctrl['wait'] + timeout = plt_reboot_ctrl['timeout'] if warmboot_finalizer_timeout == 0 and 'warmboot_finalizer_timeout' in reboot_ctrl: warmboot_finalizer_timeout = reboot_ctrl['warmboot_finalizer_timeout'] except KeyError: From cd85d66c2ae7582557245e9072c708fd37b4c919 Mon Sep 17 00:00:00 2001 From: ansrajpu Date: Tue, 4 Apr 2023 11:19:37 -0400 Subject: [PATCH 2/6] Adding checks for system up before config_reload is initiated --- tests/platform_tests/test_reload_config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/platform_tests/test_reload_config.py b/tests/platform_tests/test_reload_config.py index e3fe32e13e..b178f8018e 100644 --- a/tests/platform_tests/test_reload_config.py +++ b/tests/platform_tests/test_reload_config.py @@ -110,8 +110,12 @@ def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, # 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) + executable="/bin/bash", module_ignore_errors=True) assert "Retry later" in out['stdout'] assert wait_until(300, 20, 0, config_system_checks_passed, duthost) From d22685bd2873826b091e4187daee48846955bfdb Mon Sep 17 00:00:00 2001 From: ansrajpu Date: Thu, 15 Jun 2023 09:59:15 -0400 Subject: [PATCH 3/6] Corrected Flake8 error --- tests/platform_tests/test_reload_config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/platform_tests/test_reload_config.py b/tests/platform_tests/test_reload_config.py index b178f8018e..9cce0e836d 100644 --- a/tests/platform_tests/test_reload_config.py +++ b/tests/platform_tests/test_reload_config.py @@ -114,8 +114,7 @@ def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, 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) + 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) From da0cf57662d1a2d9b0b413f89777a130ff7912e6 Mon Sep 17 00:00:00 2001 From: wenyiz2021 <91497961+wenyiz2021@users.noreply.github.com> Date: Fri, 23 Jun 2023 12:05:08 -0700 Subject: [PATCH 4/6] Update reboot.py --- tests/common/reboot.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/common/reboot.py b/tests/common/reboot.py index 7e5f2b2dc3..854840298f 100644 --- a/tests/common/reboot.py +++ b/tests/common/reboot.py @@ -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 @@ -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: From 7857437d11c9d0ec091c091a9104078cf11a50db Mon Sep 17 00:00:00 2001 From: wenyiz2021 <91497961+wenyiz2021@users.noreply.github.com> Date: Fri, 23 Jun 2023 12:05:50 -0700 Subject: [PATCH 5/6] Update test_reload_config.py --- tests/platform_tests/test_reload_config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/platform_tests/test_reload_config.py b/tests/platform_tests/test_reload_config.py index 9cce0e836d..cfb8a50ab4 100644 --- a/tests/platform_tests/test_reload_config.py +++ b/tests/platform_tests/test_reload_config.py @@ -88,7 +88,8 @@ def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, 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) @@ -114,7 +115,8 @@ def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, 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) + 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) From 8f1294ffcd0e61ba6ea503f77b7b975b0ba86df5 Mon Sep 17 00:00:00 2001 From: wenyiz2021 <91497961+wenyiz2021@users.noreply.github.com> Date: Fri, 23 Jun 2023 12:56:32 -0700 Subject: [PATCH 6/6] change to run on every sku --- tests/platform_tests/test_reload_config.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/platform_tests/test_reload_config.py b/tests/platform_tests/test_reload_config.py index cfb8a50ab4..5c1da5bc8c 100644 --- a/tests/platform_tests/test_reload_config.py +++ b/tests/platform_tests/test_reload_config.py @@ -23,11 +23,12 @@ ] -def test_reload_configuration(duthosts, rand_one_dut_hostname, conn_graph_facts, xcvr_skip_list): # noqa F811 +def test_reload_configuration(duthosts, enum_rand_one_per_hwsku_hostname, + conn_graph_facts, xcvr_skip_list): # noqa F811 """ @summary: This test case is to reload the configuration and check platform status """ - duthost = duthosts[rand_one_dut_hostname] + duthost = duthosts[enum_rand_one_per_hwsku_hostname] interfaces = conn_graph_facts["device_conn"][duthost.hostname] asic_type = duthost.facts["asic_type"] @@ -78,12 +79,12 @@ def check_database_status(duthost): return True -def test_reload_configuration_checks(duthosts, rand_one_dut_hostname, +def test_reload_configuration_checks(duthosts, enum_rand_one_per_hwsku_hostname, localhost, conn_graph_facts, xcvr_skip_list): # noqa F811 """ @summary: This test case is to test various system checks in config reload """ - duthost = duthosts[rand_one_dut_hostname] + duthost = duthosts[enum_rand_one_per_hwsku_hostname] if not config_force_option_supported(duthost): return