diff --git a/tests/common/reboot.py b/tests/common/reboot.py index 4e63f660ae3..e73e82c9f5b 100644 --- a/tests/common/reboot.py +++ b/tests/common/reboot.py @@ -274,10 +274,27 @@ def reboot(duthost, localhost, reboot_type='cold', delay=10, pool.terminate() dut_uptime = duthost.get_up_time(utc_timezone=True) logger.info('DUT {} up since {}'.format(hostname, dut_uptime)) + # some device does not have onchip clock and requires obtaining system time a little later from ntp + # or SUP to obtain the correct time so if the uptime is less than original device time, it means it + # is most likely due to this issue which we can wait a little more until the correct time is set in place. + if float(dut_uptime.strftime("%s")) < float(dut_datetime.strftime("%s")): + logger.info('DUT {} timestamp went backwards'.format(hostname)) + wait_until(120, 5, 0, positive_uptime, duthost, dut_datetime) + + dut_uptime = duthost.get_up_time() + assert float(dut_uptime.strftime("%s")) > float(dut_datetime.strftime("%s")), "Device {} did not reboot". \ format(hostname) +def positive_uptime(duthost, dut_datetime): + dut_uptime = duthost.get_up_time() + if float(dut_uptime.strftime("%s")) < float(dut_datetime.strftime("%s")): + return False + + return True + + def get_reboot_cause(dut): """ @summary: get the reboot cause on DUT. diff --git a/tests/platform_tests/test_reload_config.py b/tests/platform_tests/test_reload_config.py index 418a1034a21..8775090939c 100644 --- a/tests/platform_tests/test_reload_config.py +++ b/tests/platform_tests/test_reload_config.py @@ -121,7 +121,10 @@ def test_reload_configuration_checks(duthosts, enum_rand_one_per_hwsku_hostname, plt_reboot_ctrl_overwrite=False) # Check if all database containers have started - wait_until(60, 1, 0, check_database_status, duthost) + # Some device after reboot may take some longer time to have database container started up + # we must give it a little longer or else it may falsely fail the test. + wait_until(360, 1, 0, check_database_status, duthost) + # Check if interfaces-config.service is exited wait_until(60, 1, 0, check_interfaces_config_service_status, duthost)