コード例 #1
0
def test_task_exit():
    global fake_run_task_return_values
    fake_run_task_return_values = {
        os.path.join(tasksd, '0-say-foo.py'): 'EXIT',
    }

    config = Config()
    config.max_time = 1
    fake_halt_task_name = 'mrrrgns_lil_halt_task'
    config.halt_task = fake_halt_task_name

    return_value = runner.process_taskdir(config, tasksd)
    assert return_value is False
    # 0-say-foo.py == 1 calls to run_task
    assert len(fake_run_task_arguments) == 1
    assert fake_run_task_arguments[0][0][0] == os.path.join(tasksd, '0-say-foo.py')
コード例 #2
0
def test_task_retries():
    config = Config()
    config.max_time = 1
    config.max_tries = 2
    config.retry_jitter = 0
    fake_halt_task_name = 'mrrrgns_lil_halt_task'
    config.halt_task = fake_halt_task_name

    return_value = runner.process_taskdir(config, tasksd)
    assert return_value is False
    # 0-say-foo.py + 2x 1-say-bar.py (retry) + halt == 4 calls to run_task
    assert len(fake_run_task_arguments) == 4
    assert fake_run_task_arguments[0][0][0] == os.path.join(tasksd, '0-say-foo.py')
    for offset in (1, 2):
        assert fake_run_task_arguments[offset][0][0] == os.path.join(tasksd, '1-say-bar.py')
    assert fake_run_task_arguments[3][0][0] == os.path.join(tasksd, fake_halt_task_name)
コード例 #3
0
def test_task_exit():
    global fake_run_task_return_values
    fake_run_task_return_values = {
        os.path.join(tasksd, '0-say-foo.py'): 'EXIT',
    }

    config = Config()
    config.max_time = 1
    fake_halt_task_name = 'mrrrgns_lil_halt_task'
    config.halt_task = fake_halt_task_name

    return_value = runner.process_taskdir(config, tasksd)
    assert return_value is False
    # 0-say-foo.py == 1 calls to run_task
    assert len(fake_run_task_arguments) == 1
    assert fake_run_task_arguments[0][0][0] == os.path.join(
        tasksd, '0-say-foo.py')
コード例 #4
0
def test_task_retries():
    config = Config()
    config.max_time = 1
    config.max_tries = 2
    config.retry_jitter = 0
    fake_halt_task_name = 'mrrrgns_lil_halt_task'
    config.halt_task = fake_halt_task_name

    return_value = runner.process_taskdir(config, tasksd)
    assert return_value is False
    # 0-say-foo.py + 2x 1-say-bar.py (retry) + halt == 4 calls to run_task
    assert len(fake_run_task_arguments) == 4
    assert fake_run_task_arguments[0][0][0] == os.path.join(
        tasksd, '0-say-foo.py')
    for offset in (1, 2):
        assert fake_run_task_arguments[offset][0][0] == os.path.join(
            tasksd, '1-say-bar.py')
    assert fake_run_task_arguments[3][0][0] == os.path.join(
        tasksd, fake_halt_task_name)