def test_check_logging_config_master_fails_on_unscheduled_deployment(name, pods, response, logging_driver, extra_words):
    def execute_module(module_name, args):
        if module_name == "docker_info":
            return {
                "info": {
                    "LoggingDriver": logging_driver,
                }
            }

        return {}

    task_vars = dict(
        group_names=["masters"],
        openshift=dict(
            common=dict(config_base=""),
        ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.get_pods_for_component = lambda _: pods

    with pytest.raises(OpenShiftCheckException) as error:
        check.check_logging_config()

    assert error is not None
    for word in extra_words:
        assert word in str(error)
def test_check_logging_config_non_master_failed(name, use_journald, logging_driver, words):
    def execute_module(module_name, args):
        if module_name == "docker_info":
            return {
                "info": {
                    "LoggingDriver": logging_driver,
                }
            }

        return {}

    task_vars = dict(
        group_names=["nodes", "etcd"],
        openshift_logging_fluentd_use_journal=use_journald,
        openshift=dict(
            common=dict(config_base=""),
        ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.execute_module = execute_module
    error = check.check_logging_config()

    assert error is not None
    for word in words:
        assert word in error
def test_check_logging_config_master_failed(name, pods, logging_driver, words):
    def execute_module(module_name, args):
        if module_name == "docker_info":
            return {
                "info": {
                    "LoggingDriver": logging_driver,
                }
            }

        return {}

    task_vars = dict(
        group_names=["masters"],
        openshift=dict(
            common=dict(config_base=""),
        ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.execute_module = execute_module
    check.get_pods_for_component = lambda _: pods
    error = check.check_logging_config()

    assert error is not None
    for word in words:
        assert word in error
Ejemplo n.º 4
0
def test_check_logging_config_master_fails_on_unscheduled_deployment(
        name, pods, response, logging_driver, extra_words):
    def execute_module(module_name, args):
        if module_name == "docker_info":
            return {
                "info": {
                    "LoggingDriver": logging_driver,
                }
            }

        return {}

    task_vars = dict(
        group_names=["masters"],
        openshift=dict(common=dict(config_base=""), ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.get_pods_for_component = lambda _: pods

    with pytest.raises(OpenShiftCheckException) as error:
        check.check_logging_config()

    assert error is not None
    for word in extra_words:
        assert word in str(error)
Ejemplo n.º 5
0
def test_check_logging_config_non_master_failed(name, use_journald,
                                                logging_driver, words):
    def execute_module(module_name, args):
        if module_name == "docker_info":
            return {
                "info": {
                    "LoggingDriver": logging_driver,
                }
            }

        return {}

    task_vars = dict(
        group_names=["nodes", "etcd"],
        openshift_logging_fluentd_use_journal=use_journald,
        openshift=dict(common=dict(config_base=""), ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.execute_module = execute_module
    error = check.check_logging_config()

    assert error is not None
    for word in words:
        assert word in error
def test_check_logging_config_master_failed(name, pods, logging_driver, words):
    def execute_module(module_name, args):
        if module_name == "docker_info":
            return {
                "info": {
                    "LoggingDriver": logging_driver,
                }
            }

        return {}

    task_vars = dict(
        group_names=["masters"],
        openshift=dict(common=dict(config_base=""), ),
    )

    def get_pods(namespace, logging_component):
        return pods, None

    check = FluentdConfig(execute_module, task_vars)
    check.execute_module = execute_module
    check.get_pods_for_component = get_pods
    error = check.check_logging_config()

    assert error is not None
    for word in words:
        assert word in error
Ejemplo n.º 7
0
def test_check_logging_config_master(name, pods, logging_driver, extra_words):
    def execute_module(module_name, args):
        if module_name == "command":
            return dict(stdout='{"LoggingDriver": "%s"}' % logging_driver)
        return {}

    task_vars = dict(
        group_names=["oo_masters_to_config"],
        openshift=dict(common=dict(config_base=""), ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.execute_module = execute_module
    check.get_pods_for_component = lambda _: pods
    error = check.check_logging_config()

    assert error is None
Ejemplo n.º 8
0
def test_check_logging_config_non_master(name, use_journald, logging_driver,
                                         extra_words):
    def execute_module(module_name, args):
        if module_name == "command":
            return dict(stdout='{"LoggingDriver": "%s"}' % logging_driver)
        return {}

    task_vars = dict(
        group_names=["oo_nodes_to_config", "oo_etcd_to_config"],
        openshift_logging_fluentd_use_journal=use_journald,
        openshift=dict(common=dict(config_base=""), ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.execute_module = execute_module
    error = check.check_logging_config()

    assert error is None
Ejemplo n.º 9
0
def test_check_logging_config_master(name, pods, logging_driver, extra_words):
    def execute_module(module_name, args):
        if module_name == "docker_info":
            return {
                "info": {
                    "LoggingDriver": logging_driver,
                }
            }

        return {}

    task_vars = dict(
        group_names=["masters"],
        openshift=dict(common=dict(config_base=""), ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.execute_module = execute_module
    check.get_pods_for_component = lambda _: pods
    error = check.check_logging_config()

    assert error is None
def test_check_logging_config_non_master(name, use_journald, logging_driver, extra_words):
    def execute_module(module_name, args):
        if module_name == "docker_info":
            return {
                "info": {
                    "LoggingDriver": logging_driver,
                }
            }

        return {}

    task_vars = dict(
        group_names=["oo_nodes_to_config", "oo_etcd_to_config"],
        openshift_logging_fluentd_use_journal=use_journald,
        openshift=dict(
            common=dict(config_base=""),
        ),
    )

    check = FluentdConfig(execute_module, task_vars)
    check.execute_module = execute_module
    error = check.check_logging_config()

    assert error is None