Exemple #1
0
def test_should_run_slip_longer_than_downtime():
    # set slip to 3 minutes, next occurrence slated to 3 minuted ago
    # Note: should_run gives a 1 minute "grace" on top of what's set slip by
    # the user, to account for check_schedules() running every 1 minute
    next_occurrence = datetime.strftime(
        datetime.utcnow() - timedelta(minutes=3), '%Y-%m-%d %H:%M:%S')
    schedule = _get_mock_schedule(next_occurrence=next_occurrence, slip=3)
    assert should_run(schedule)
Exemple #2
0
def test_should_run_dont_stop_on_fail():
    schedule = _get_mock_schedule(
        stop_on_fail=False, latest_execution=models.Execution(status='failed'))
    assert should_run(schedule)
    assert schedule.enabled
Exemple #3
0
def test_should_run_slip_shorter_than_downtime():
    next_occurrence = datetime.strftime(
        datetime.utcnow() - timedelta(minutes=3), '%Y-%m-%d %H:%M:%S')
    schedule = _get_mock_schedule(next_occurrence=next_occurrence, slip=2)
    assert not should_run(schedule)
Exemple #4
0
def test_should_run_skip_if_last_execution_unfinished():
    schedule = _get_mock_schedule(latest_execution=models.Execution(
        status='started'))
    assert not should_run(schedule)