From f4c9b45c568ffb9f189e81cacbc75ac37a90f952 Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Mon, 10 Feb 2020 01:46:08 +0800 Subject: [PATCH] [test_reboot]Wait a few seconds before checking the reboot-cause (#1367) In the reboot cause test it is assumed that the reboot-cause is available as soon as the critical services ready. However, PR Delay process-reboot-cause service until network connection is stable #4003 introduces an extra amount of seconds and fails the assumption. --- tests/platform/test_reboot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/platform/test_reboot.py b/tests/platform/test_reboot.py index b834730cf1..2ee06893f3 100644 --- a/tests/platform/test_reboot.py +++ b/tests/platform/test_reboot.py @@ -84,7 +84,7 @@ def check_reboot_cause(dut, reboot_cause_expected): reboot_cause_got = output["stdout"] logging.debug("show reboot-cause returns {}".format(reboot_cause_got)) m = re.search(reboot_cause_expected, reboot_cause_got) - assert m is not None, "got reboot-cause %s after rebooted by %s" % (reboot_cause_got, reboot_cause_expected) + return m is not None def reboot_and_check(localhost, dut, interfaces, reboot_type=REBOOT_TYPE_COLD, reboot_helper=None, reboot_kwargs=None): @@ -139,7 +139,8 @@ def reboot_and_check(localhost, dut, interfaces, reboot_type=REBOOT_TYPE_COLD, r check_critical_services(dut) logging.info("Check reboot cause") - check_reboot_cause(dut, reboot_cause) + assert wait_until(120, 20, check_reboot_cause, dut, reboot_cause), \ + "got reboot-cause failed after rebooted by %s" % reboot_cause if reboot_ctrl_dict[reboot_type]["test_reboot_cause_only"]: logging.info("Further checking skipped for %s test which intends to verify reboot-cause only".format(reboot_type))