Skip to content

Bug: Test flakiness in reboot_test.py due to delay in time.time() calls #23745

Description

@arista-hpandya

Is it platform specific

generic

Importance or Severity

Medium

Description of the bug

In the reboot_test.py, the assert calls check for the exact timestamp to match. However sometimes there is a delay between when the call is made and when the assert is checked. If this delay is greater than 1 second, the timestamps diverge and the assert fails. This is a flakiness introduced by the test framework and hence we should mock it and make it more robust.

Steps to Reproduce

This is a hard to reproduce bug since it is heavily based on the timing delay. One can reproduce this by adding a sleep before the assert to simulate a delay of a few seconds.

Actual Behavior and Expected Behavior

Actual behaviour:

self = <MagicMock name='populate_reboot_status_flag' id='140170956134720'>
02:53:26  args = (False, 1774000374, 'Halt reboot did not complete', 3, <RebootStatus.STATUS_FAILURE: 3>)
02:53:26  kwargs = {}
02:53:26  expected = call(False, 1774000374, 'Halt reboot did not complete', 3, <RebootStatus.STATUS_FAILURE: 3>)
02:53:26  actual = call(False, 1774000373, 'Halt reboot did not complete', 3, <RebootStatus.STATUS_FAILURE: 3>)

Expected behaviour: Should not fail because of a timestamp mismatch.

Relevant log output

Output of show version, show techsupport

Attach files (if any)

No response

Metadata

Metadata

Type

No type

Projects

Status
No status
Status
In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions