Exemple #1
0
def test_assert_can_run_throws_exception_when_runtime_exceeded(
    report_maintainer_mock,
    backfill_tool_mock,
    secretary,
    record_ready_for_processing,
    sheriff_settings,
    notify_client_mock,
):
    no_time_left = timedelta(seconds=0)
    sheriff_bot = PerfSheriffBot(report_maintainer_mock, backfill_tool_mock,
                                 secretary, notify_client_mock, no_time_left)

    with pytest.raises(MaxRuntimeExceeded):
        sheriff_bot.assert_can_run()
Exemple #2
0
def test_assert_can_run_doesnt_throw_exception_when_enough_time_left(
    report_maintainer_mock,
    backfill_tool_mock,
    secretary,
    notify_client_mock,
    record_ready_for_processing,
    sheriff_settings,
):
    enough_time_left = timedelta(minutes=10)
    sheriff_bot = PerfSheriffBot(report_maintainer_mock, backfill_tool_mock,
                                 secretary, notify_client_mock,
                                 enough_time_left)

    try:
        sheriff_bot.assert_can_run()
    except MaxRuntimeExceeded:
        pytest.fail()