diff --git a/tests/platform/test_reboot.py b/tests/platform/test_reboot.py index 2332d2f644..e3d4674ee9 100644 --- a/tests/platform/test_reboot.py +++ b/tests/platform/test_reboot.py @@ -77,7 +77,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): @@ -132,7 +132,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))