Пример #1
0
def test_task_exit_codes():
    env = {}
    bash_cmd = ['/usr/bin/env', 'bash', '-c']
    success_t = bash_cmd + ['exit 0']
    halt_t = bash_cmd + ['exit 2']
    retry_t = bash_cmd + ['exit 1']

    assert run_task(success_t, env, 1) == "OK"
    assert run_task(halt_t, env, 1) == "HALT"
    assert run_task(retry_t, env, 1) == "RETRY"
Пример #2
0
def test_task_exit_codes():
    env = {}
    bash_cmd = ['/usr/bin/env', 'bash', '-c']
    success_t = bash_cmd + ['exit 0']
    halt_t = bash_cmd + ['exit 2']
    retry_t = bash_cmd + ['exit 1']

    assert run_task(success_t, env, 1) == "OK"
    assert run_task(halt_t, env, 1) == "HALT"
    assert run_task(retry_t, env, 1) == "RETRY"
Пример #3
0
def test_max_time():
    t = ['sleep', '2']
    env = {}
    max_time = 1
    assert runner.run_task(t, env, max_time) == "RETRY"
Пример #4
0
def test_max_time():
    t = ['sleep', '2']
    env = {}
    max_time = 1
    assert run_task(t, env, max_time) == "RETRY"
Пример #5
0
def run_task(name, config_dict=None):
    import runner
    return runner.run_task([name], config_dict)