def canned_loggingcheck(exec_oc=None):
    """Create a LoggingCheck object with canned exec_oc method"""
    check = LoggingCheck()  # fails if a module is actually invoked
    check.logging_namespace = 'logging'
    if exec_oc:
        check.exec_oc = exec_oc
    return check
def canned_loggingcheck(exec_oc=None):
    """Create a LoggingCheck object with canned exec_oc method"""
    check = LoggingCheck("dummy")  # fails if a module is actually invoked
    check.logging_namespace = 'logging'
    if exec_oc:
        check.exec_oc = exec_oc
    return check
Ejemplo n.º 3
0
def test_oc_failure(problem, expect):
    def execute_module(module_name, *_):
        if module_name == "ocutil":
            return dict(failed=True, result=problem)
        return dict(changed=False)

    check = LoggingCheck(execute_module, task_vars_config_base)

    with pytest.raises(CouldNotUseOc) as excinfo:
        check.exec_oc('get foo', [])
    assert expect in str(excinfo)
def test_oc_failure(problem, expect):
    def execute_module(module_name, *_):
        if module_name == "ocutil":
            return dict(failed=True, result=problem)
        return dict(changed=False)

    check = LoggingCheck(execute_module, task_vars_config_base)

    with pytest.raises(CouldNotUseOc) as excinfo:
        check.exec_oc('get foo', [])
    assert expect in str(excinfo)
def test_oc_failure(problem, expect):
    def execute_module(module_name, args, tmp, task_vars):
        if module_name == "ocutil":
            return dict(failed=True, result=problem)
        return dict(changed=False)

    check = LoggingCheck({})

    with pytest.raises(OpenShiftCheckException) as excinfo:
        check.exec_oc(execute_module, logging_namespace, 'get foo', [], task_vars=task_vars_config_base)
    assert expect in str(excinfo)
Ejemplo n.º 6
0
def test_oc_failure(problem, expect):
    def execute_module(module_name, args, task_vars):
        if module_name == "ocutil":
            return dict(failed=True, result=problem)
        return dict(changed=False)

    check = LoggingCheck({})

    with pytest.raises(OpenShiftCheckException) as excinfo:
        check.exec_oc(execute_module, logging_namespace, 'get foo', [], task_vars=task_vars_config_base)
    assert expect in str(excinfo)
Ejemplo n.º 7
0
def test_is_active(groups, logging_deployed, is_active):
    task_vars = dict(
        ansible_host='this-host',
        groups=groups,
        openshift_hosted_logging_deploy=logging_deployed,
    )

    assert LoggingCheck(None, task_vars).is_active() == is_active
def test_is_active(groups, logging_deployed, is_active):
    task_vars = dict(
        ansible_ssh_host='this-host',
        groups=groups,
        openshift_hosted_logging_deploy=logging_deployed,
    )

    assert LoggingCheck.is_active(task_vars=task_vars) == is_active
Ejemplo n.º 9
0
def canned_loggingcheck(exec_oc=None, execute_module=None):
    """Create a LoggingCheck object with canned exec_oc method"""
    check = LoggingCheck(execute_module)
    if exec_oc:
        check.exec_oc = exec_oc
    return check
def canned_loggingcheck(exec_oc=None, execute_module=None):
    """Create a LoggingCheck object with canned exec_oc method"""
    check = LoggingCheck(execute_module)
    if exec_oc:
        check.exec_oc = exec_oc
    return check