diff --git a/tests/platform/test_reboot.py b/tests/platform/test_reboot.py index 67c65063fa..f8012fd305 100644 --- a/tests/platform/test_reboot.py +++ b/tests/platform/test_reboot.py @@ -70,7 +70,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): @@ -125,7 +125,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 {} test which intends to verify reboot-cause only".format(reboot_type))