Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/common/reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion tests/platform_tests/test_reload_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down