Ejemplo n.º 1
0
def test_reserve_job_with_two_jobs_due_to_run(freezer):
    scheduler.schedule_job("good_job", {"k": "v"}, "channel", TS, 5)
    scheduler.schedule_job("odd_job", {"k": "v"}, "channel", TS, 6)
    freezer.move_to(T(10))

    job_id = scheduler.reserve_job()
    job = scheduler.get_job(job_id)
    assert_job_matches(job, "good_job", {"k": "v"}, "channel", T(5), T(10))

    job_id = scheduler.reserve_job()
    job = scheduler.get_job(job_id)
    assert_job_matches(job, "odd_job", {"k": "v"}, "channel", T(6), T(10))
Ejemplo n.º 2
0
def test_reserve_job_with_suppression_in_future(freezer):
    scheduler.schedule_suppression("good_job", T(15), T(20))
    scheduler.schedule_job("good_job", {"k": "v"}, "channel", TS, 5)
    freezer.move_to(T(10))

    job_id = scheduler.reserve_job()
    job = scheduler.get_job(job_id)
    assert_job_matches(job, "good_job", {"k": "v"}, "channel", T(5), T(10))
Ejemplo n.º 3
0
def test_reserve_job_with_suppression_in_progress_for_another_job_type(freezer):
    scheduler.schedule_job("good_job", {"k": "v"}, "channel", TS, 5)
    scheduler.schedule_suppression("odd_job", T(10), T(20))
    freezer.move_to(T(15))

    job_id = scheduler.reserve_job()
    job = scheduler.get_job(job_id)
    assert_job_matches(job, "good_job", {"k": "v"}, "channel", T(5), T(15))
Ejemplo n.º 4
0
def test_reserve_job_with_another_job_running(freezer):
    scheduler.schedule_job("good_job", {"k": "v"}, "channel", TS, 5)
    freezer.move_to(T(10))
    scheduler.reserve_job()
    scheduler.schedule_job("odd_job", {"k": "w"}, "channel1", TS, 5)
    freezer.move_to(T(20))

    job_id = scheduler.reserve_job()
    job = scheduler.get_job(job_id)
    assert_job_matches(job, "odd_job", {"k": "w"}, "channel1", T(15), T(20))