Skip to content

Commit

Permalink
[test] Allow schedule next_run on new task from [0, 1s] to [0, 2s]
Browse files Browse the repository at this point in the history
This will fix rare check failures

o test_define_correct_schedule_with_next_run_immediate_when_no_last_run

Change acceptable next_run value on a new task from [0, 1s] -> [0, 2s]

tested ok on 12000 runs
  • Loading branch information
cgalibern committed Jan 15, 2021
1 parent 2bcf693 commit b00c76c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion opensvc/tests/commands/svc/test_run_task.py
Expand Up @@ -137,7 +137,8 @@ def test_define_correct_schedule_with_next_run_immediate_when_no_last_run(tmp_fi
"schedule_definition": "@3"
}
delta = now - datetime.datetime.strptime(schedule_run['next_run'], "%Y-%m-%d %H:%M:%S")
assert delta < datetime.timedelta(seconds=1)
# rarely delta is between 1 and 2 (1 time on 400 runs), most of time < 1
assert delta < datetime.timedelta(seconds=2)

@staticmethod
def test_define_correct_schedule_when_has_last_run(mocker, capsys):
Expand Down

0 comments on commit b00c76c

Please sign in to comment.