コード例 #1
0
def test_log_matches_high_traffic_msg(group_names, matched, failed,
                                      extra_words):
    def execute_module(module_name, *_):
        return {
            "matched": matched,
            "failed": failed,
        }

    task_vars = dict(group_names=group_names, openshift_service_type="origin")

    result = EtcdTraffic(execute_module, task_vars).run()

    for word in extra_words:
        assert word in result.get("msg", "")

    assert result.get("failed", False) == failed
コード例 #2
0
def test_log_matches_high_traffic_msg(group_names, matched, failed, extra_words):
    def execute_module(module_name, *_):
        return {
            "matched": matched,
            "failed": failed,
        }

    task_vars = dict(
        group_names=group_names,
        openshift_is_containerized=False,
        openshift_service_type="origin"
    )

    result = EtcdTraffic(execute_module, task_vars).run()

    for word in extra_words:
        assert word in result.get("msg", "")

    assert result.get("failed", False) == failed
コード例 #3
0
ファイル: etcd_traffic_test.py プロジェクト: PyRoOP/open
def test_systemd_unit_matches_deployment_type(openshift_is_containerized,
                                              expected_unit_value):
    task_vars = dict(openshift_is_containerized=openshift_is_containerized)

    def execute_module(module_name, args, *_):
        assert module_name == "search_journalctl"
        matchers = args["log_matchers"]

        for matcher in matchers:
            assert matcher["unit"] == expected_unit_value

        return {"failed": False}

    EtcdTraffic(execute_module, task_vars).run()
コード例 #4
0
ファイル: etcd_traffic_test.py プロジェクト: PyRoOP/open
def test_is_active(group_names, version, is_active):
    task_vars = dict(
        group_names=group_names,
        openshift_image_tag=version,
    )
    assert EtcdTraffic(task_vars=task_vars).is_active() == is_active
コード例 #5
0
def test_is_active(group_names, version, is_active):
    task_vars = dict(
        group_names=group_names,
        openshift=dict(common=dict(short_version=version), ),
    )
    assert EtcdTraffic(task_vars=task_vars).is_active() == is_active