Beispiel #1
0
def test_ended_preemtively():
    lines = """\
QMNAME(THE.ENDED.ONE)                                     STATUS(ENDED PREEMPTIVELY) DEFAULT(NO) STANDBY(NOT APPLICABLE) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(7.5.0.2)
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)
    params: Dict[str, Any] = {}
    actual = list(check.run_check("THE.ENDED.ONE", params, parsed))
    expected = [
        (1, "Status: ENDED PREEMPTIVELY"),
        (0, "Version: 7.5.0.2"),
        (0, "Installation: /opt/mqm (Installation1), Default: NO"),
    ]
    assert expected == actual

    lines = """\
QMNAME(THE.ENDED.ONE)                                     STATUS(ENDED PRE-EMPTIVELY) DEFAULT(NO) STANDBY(NOT APPLICABLE) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(8.0.0.1)
"""
    section = parse_info(lines, chr(10))
    parsed = check.run_parse(section)
    actual = list(check.run_check("THE.ENDED.ONE", params, parsed))
    expected = [
        (1, "Status: ENDED PRE-EMPTIVELY"),
        (0, "Version: 8.0.0.1"),
        (0, "Installation: /opt/mqm (Installation1), Default: NO"),
    ]
    assert expected == actual
def test_check_win_license(capture, result):
    check = Check("win_license")
    output = check.run_check(
        None, result.parameters or check.default_parameters(), check.run_parse(splitter(capture))
    )

    assertCheckResultsEqual(CheckResult(output), result.check_output)
Beispiel #3
0
def test_parse_empty_address():
    check = Check("arista_bgp")
    data = [
        [
            [],
            [0, 0, 0, 0],
            "65007",
            [0, 0, 0, 0],
            "2",
            "1",
            "",
            "1.1.4.192.168.1.2",
        ]
    ]
    assert check.run_parse([data]) == {
        "192.168.1.2": {
            "Admin state": "running",
            "BGP version": 4,
            "Last received error": "",
            "Local address": "empty()",
            "Local identifier": "0.0.0.0",
            "Peer state": "idle",
            "Remote AS number": 65007,
            "Remote identifier": "0.0.0.0",
        },
    }
Beispiel #4
0
def test_parse_simple():
    check = Check("arista_bgp")
    data = [
        [
            [192, 168, 1, 1],
            [10, 10, 10, 10],
            "65000",
            [192, 168, 2, 0],
            "2",
            "6",
            "Cease/other configuration change",
            "1.1.4.192.168.1.2",
        ]
    ]
    assert check.run_parse([data]) == {
        "192.168.1.2": {
            "Admin state": "running",
            "BGP version": 4,
            "Last received error": "Cease/other configuration change",
            "Local address": "192.168.1.1",
            "Local identifier": "10.10.10.10",
            "Peer state": "established",
            "Remote AS number": 65000,
            "Remote identifier": "192.168.2.0",
        }
    }
Beispiel #5
0
def test_parse():
    lines = """\
QMNAME(THE.LOCAL.ONE)                                     STATUS(RUNNING) DEFAULT(NO) STANDBY(NOT PERMITTED) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(8.0.0.6) HA() DRROLE()
   INSTANCE(sb112233) MODE(ACTIVE)
QMNAME(THE.MULTI.INSTANCE.ONE)                            STATUS(RUNNING) DEFAULT(NO) STANDBY(PERMITTED) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(8.0.0.6) HA() DRROLE()
   INSTANCE(sb112233) MODE(ACTIVE)
   INSTANCE(sb112255) MODE(STANDBY)
QMNAME(THE.RDQM.ONE)                                      STATUS(RUNNING) DEFAULT(NO) STANDBY(NOT PERMITTED) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(9.1.0.4) HA(REPLICATED) DRROLE()
    INSTANCE(sb008877) MODE(ACTIVE)
QMNAME(THE.SLEEPING.ONE)                                  STATUS(ENDED NORMALLY) DEFAULT(NO) STANDBY(NOT APPLICABLE) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(7.5.0.1) HA() DRROLE()
QMNAME(THE.CRASHED.ONE)                                   STATUS(ENDED UNEXPECTEDLY) DEFAULT(NO) STANDBY(NOT APPLICABLE) INSTNAME(Installation2) INSTPATH(/opt/mqm9) INSTVER(9.0.0.6) HA() DRROLE()
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)
    assert len(parsed) == 5

    attrs = parsed["THE.LOCAL.ONE"]
    assert attrs["STATUS"] == "RUNNING"
    assert [("sb112233", "ACTIVE")] == attrs["INSTANCES"]

    attrs = parsed["THE.MULTI.INSTANCE.ONE"]
    assert [("sb112233", "ACTIVE"),
            ("sb112255", "STANDBY")] == attrs["INSTANCES"]

    attrs = parsed["THE.CRASHED.ONE"]
    assert attrs["QMNAME"] == "THE.CRASHED.ONE"
    assert attrs["STATUS"] == "ENDED UNEXPECTEDLY"
    assert attrs["STANDBY"] == "NOT APPLICABLE"
    assert "INSTANCES" not in attrs
Beispiel #6
0
def test_parse_svrconn_with_multiple_instances():
    lines = """\
QMNAME(MY.TEST)                                           STATUS(RUNNING) NOW(2020-04-03T17:27:02+0200)
5724-H72 (C) Copyright IBM Corp. 1994, 2015.
Starting MQSC for queue manager MY.TEST.

AMQ8417: Display Channel Status details.
   CHANNEL(XXXXXX.IIB.SVRCONN)             CHLTYPE(SVRCONN)
   CONNAME(10.25.19.182)                   CURRENT
   STATUS(RUNNING)                         SUBSTATE(RECEIVE)
AMQ8417: Display Channel Status details.
   CHANNEL(XXXXXX.IIB.SVRCONN)             CHLTYPE(SVRCONN)
   CONNAME(10.25.19.183)                   CURRENT
   STATUS(RUNNING)                         SUBSTATE(RECEIVE)
One MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)
    attrs = parsed["MY.TEST:XXXXXX.IIB.SVRCONN"]
    assert attrs["CHLTYPE"] == "SVRCONN"
    assert attrs["STATUS"] == "RUNNING"
    # Last entry of the instances defines the values
    assert attrs["CONNAME"] == "10.25.19.183"
Beispiel #7
0
def test_nfsmounts(info, discovery_expected, check_expected):
    check_nfs = Check("nfsmounts")
    check_cifs = Check("cifsmounts")

    # assure that the code of both checks is identical
    assert (
        check_nfs.info["parse_function"].__code__.co_code
        == check_cifs.info["parse_function"].__code__.co_code
    )
    assert (
        check_nfs.info["inventory_function"].__code__.co_code
        == check_cifs.info["inventory_function"].__code__.co_code
    )
    assert (
        check_nfs.info["check_function"].__code__.co_code
        == check_cifs.info["check_function"].__code__.co_code
    )

    parsed = check_nfs.run_parse(info)

    assertDiscoveryResultsEqual(
        check_nfs,
        DiscoveryResult(check_nfs.run_discovery(parsed)),  #
        DiscoveryResult(discovery_expected),
    )

    for item, params, result_expected in check_expected:
        result = CheckResult(check_nfs.run_check(item, params, parsed))
        assertCheckResultsEqual(result, CheckResult([result_expected]))
def test_check_docker_node_disk_usage():
    check = Check("docker_node_disk_usage")
    result = list(check.run_check("volumes", {}, check.run_parse(AGENT_OUTPUT)))
    assert result == [
        (0, "Size: 229.67 kB", [("size", 235177, None, None)]),
        (0, "Reclaimable: 93.00 B", [("reclaimable", 93, None, None)]),
        (0, "Count: 7", [("count", 7, None, None)]),
        (0, "Active: 5", [("active", 5, None, None)]),
    ]
Beispiel #9
0
def test_f5_bigip_mem_discovery(info, result):
    mem_total, mem_used, items = result
    check = Check("f5_bigip_mem")
    parsed = check.run_parse(info)

    assert list(check.run_discovery(parsed)) == items

    if items:
        assert parsed["total"] == (mem_total, mem_used)
Beispiel #10
0
def test_parse():
    lines = """\
QMNAME(MY.TEST)                                           STATUS(RUNNING) NOW(2020-04-03T17:27:02+0200)
5724-H72 (C) Copyright IBM Corp. 1994, 2015.
Starting MQSC for queue manager MY.TEST.

AMQ8414: Display Channel details.
   CHANNEL(HERE.TO.THERE.ONE)              CHLTYPE(SDR)
   XMITQ(HERE.TO.THERE.ONE.XMIT)
AMQ8414: Display Channel details.
   CHANNEL(HERE.TO.THERE.TWO)              CHLTYPE(SDR)
   XMITQ(HERE.TO.THERE.TWO.XMIT)
AMQ8414: Display Channel details.
   CHANNEL(SYSTEM.DEF.SENDER)              CHLTYPE(SDR)
   XMITQ( )
AMQ8417: Display Channel Status details.
   CHANNEL(HERE.TO.THERE.TWO)              CHLTYPE(SDR)
   COMPRATE(0,0)                           COMPTIME(0,0)
   CONNAME(55.888.222.333(1414),22,333.444.555(1414))
   EXITTIME(0,0)                           MONCHL(OFF)
   CURRENT                                 RQMNAME( )
   STATUS(RETRYING)                        SUBSTATE( )
   XBATCHSZ(0,0)                           XMITQ(HERE.TO.THERE.TWO.XMIT)
   XQTIME(0,1)
AMQ8417: Display Channel Status details.
   CHANNEL(HERE.TO.THERE.ONE)              CHLTYPE(SDR)
   COMPRATE(0,0)                           COMPTIME(0,0)
   CONNAME(62.240.197.243(1414),62.240.197.244(1414))
   EXITTIME(0,0)                           MONCHL(OFF)
   CURRENT                                 RQMNAME( )
   STATUS(RETRYING)                        SUBSTATE(MQGET)
   XBATCHSZ(0,0)                           XMITQ(HERE.TO.THERE.TWO.XMIT)
   XQTIME(0,1)
5 MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)
    assert 2 + 1 == len(parsed)

    attrs = parsed["MY.TEST"]
    assert attrs["STATUS"] == "RUNNING"
    assert attrs["NOW"] is not None

    attrs = parsed["MY.TEST:HERE.TO.THERE.TWO"]
    assert attrs["CHLTYPE"] == "SDR"
    assert attrs["STATUS"] == "RETRYING"
    assert attrs["CONNAME"] == "55.888.222.333(1414),22,333.444.555(1414)"
    assert attrs["MONCHL"] == "OFF"

    attrs = parsed["MY.TEST:HERE.TO.THERE.TWO"]
    assert attrs["CHLTYPE"] == "SDR"
    assert attrs["STATUS"] == "RETRYING"
    assert attrs["CONNAME"] == "55.888.222.333(1414),22,333.444.555(1414)"
    assert attrs["MONCHL"] == "OFF"
def test_docker_container_diskstat_check(mocker, monkeypatch):
    mocker.patch("cmk.base.item_state._get_counter", return_value=[None, 2.22])
    check = Check('docker_container_diskstat')
    result = check.run_check('dm-1', {}, check.run_parse(INFO))
    assert list(result) == [
        (0, 'Read: 2.22 B/s', [('disk_read_throughput', 2.22, None, None)]),
        (0, 'Write: 2.22 B/s', [('disk_write_throughput', 2.22, None, None)]),
        (0, 'Read operations: 2.22 1/s', [('disk_read_ios', 2.22, None, None)]),
        (0, 'Write operations: 2.22 1/s', [('disk_write_ios', 2.22, None, None)]),
    ]
def test_docker_container_diskstat_wrapped():
    check = Check('docker_container_diskstat')
    parsed = check.run_parse(INFO_MISSING_COUNTERS)

    with pytest.raises(MKCounterWrapped):
        check.run_check("SUMMARY", {}, parsed)

    with mock_item_state((0, 0)):
        # raise MKCounterWrapped anyway, because counters are missing in info
        with pytest.raises(MKCounterWrapped):
            check.run_check("SUMMARY", {}, parsed)
Beispiel #13
0
def test_wmi_msexch_isclienttype_wato_params(check_name, expected):
    check = Check(check_name)
    result = list(
        check.run_check(
            item="_total",
            params={
                "store_latency": (41.0, 51.0),
                "clienttype_latency": (40.0, 50.0),
                "clienttype_requests": (60, 70),
            },
            info=check.run_parse(info_msx_info_store_1),
        ))
    assert result == expected
Beispiel #14
0
def test_hr_ps_discovery(info, discovery_params, expected_discovery_result):
    """Test that the hr_ps check returns the correct discovery results given different
    discovery parameters.
    """
    check = Check("hr_ps")

    with MockHostExtraConf(check, discovery_params, "host_extra_conf"):
        actual_discovery_result = check.run_discovery(check.run_parse(info))

    assertDiscoveryResultsEqual(
        check,
        DiscoveryResult(actual_discovery_result),
        DiscoveryResult(expected_discovery_result),
    )
def test_parse():
    lines = """\
version: 2.0.4
dspmq: OK
runmqsc: Not executable
"""
    section = parse_info(lines, chr(58))
    check = Check(CHECK_NAME)
    actual = check.run_parse(section)
    expected = {
        "version": "2.0.4",
        "dspmq": "OK",
        "runmqsc": "Not executable",
    }
    assert actual == expected
Beispiel #16
0
def test_parse():
    lines = """\
QMNAME(MY.TEST)                                           STATUS(RUNNING) NOW(2020-04-03T17:27:02+0200)
5724-H72 (C) Copyright IBM Corp. 1994, 2015.
Starting MQSC for queue manager MY.TEST.


AMQ8409: Display Queue details.
   QUEUE(MY.QUEUE.ONE)
   TYPE(QLOCAL)                            MAXDEPTH(5000)
AMQ8409: Display Queue details.
   QUEUE(MY.QUEUE.TWO)
   TYPE(QLOCAL)                            MAXDEPTH(200000)
AMQ8450: Display queue status details.
   QUEUE(MY.QUEUE.ONE)
   TYPE(QUEUE)                             CURDEPTH(0)
   LGETDATE( )                             LGETTIME( )
   LPUTDATE( )                             LPUTTIME( )
   MONQ(MEDIUM)                            MSGAGE(0)
   QTIME( , )
AMQ8450: Display queue status details.
   QUEUE(MY.QUEUE.TWO)
   TYPE(QUEUE)                             CURDEPTH(1400)
   LGETDATE(2017-03-09)                    LGETTIME(08.49.13)
   LPUTDATE( )                             LPUTTIME( )
   OPPROCS(0)                              IPPROCS(5)
   MONQ(MEDIUM)                            MSGAGE(2201)
   QTIME(999999999, 999999999)
2 MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)
    assert 2 + 1 == len(parsed)

    attrs = parsed["MY.TEST"]
    assert attrs["STATUS"] == "RUNNING"
    assert attrs["NOW"] is not None

    attrs = parsed["MY.TEST:MY.QUEUE.TWO"]
    assert attrs["CURDEPTH"] == "1400"
    assert attrs["LGETDATE"] == "2017-03-09"
    assert attrs["LGETTIME"] == "08.49.13"
    assert attrs["CURDEPTH"] == "1400"
    assert attrs["MAXDEPTH"] == "200000"
    assert attrs["MSGAGE"] == "2201"
Beispiel #17
0
def test_version_mismatch():
    lines = """\
QMNAME(THE.RUNNING.ONE)                                   STATUS(RUNNING) DEFAULT(NO) STANDBY(NOT APPLICABLE) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(7.5.0.2)
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)
    params: Dict[str, Any] = {}
    params.update({"version": (("at_least", "8.0"), 2)})
    actual = list(check.run_check("THE.RUNNING.ONE", params, parsed))
    expected = [
        (0, "Status: RUNNING"),
        (2, "Version: 7.5.0.2 (should be at least 8.0)"),
        (0, "Installation: /opt/mqm (Installation1), Default: NO"),
    ]
    assert expected == actual
Beispiel #18
0
def test_health_parse_yields_volume_name_as_items_despite_of_durable_id():
    info = [
        ["volume", "1", "durable-id", "Foo 1"],
        ["volume", "1", "volume-name", "Bar 1"],
        ["volume", "1", "any-key-1", "abc"],
        ["volume-statistics", "1", "volume-name", "Bar 1"],
        ["volume-statistics", "1", "any-key-2", "ABC"],
        ["volume", "2", "durable-id", "Foo 2"],
        ["volume", "2", "volume-name", "Bar 2"],
        ["volume", "2", "any-key-2", "abc"],
        ["volume-statistics", "2", "volume-name", "Bar 2"],
        ["volume-statistics", "2", "any-key-2", "ABC"],
    ]
    check = Check("hp_msa_volume")
    parse_result = check.run_parse(info)
    parsed_items = sorted(parse_result.keys())
    expected_items = ["Bar 1", "Bar 2"]
    assert parsed_items == expected_items
Beispiel #19
0
def test_status_wato_override():
    lines = """\
QMNAME(THE.ENDED.ONE)                                     STATUS(ENDED PRE-EMPTIVELY) DEFAULT(NO) STANDBY(NOT APPLICABLE) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(7.5.0.2)
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)

    # Factory defaults
    params: Dict[str, Any] = {}
    actual = list(check.run_check("THE.ENDED.ONE", params, parsed))
    expected = [
        (1, "Status: ENDED PRE-EMPTIVELY"),
        (0, "Version: 7.5.0.2"),
        (0, "Installation: /opt/mqm (Installation1), Default: NO"),
    ]
    assert expected == actual

    # Override factory defaults
    params = {"mapped_states": [("ended_pre_emptively", 2)]}
    actual = list(check.run_check("THE.ENDED.ONE", params, parsed))
    expected = [
        (2, "Status: ENDED PRE-EMPTIVELY"),
        (0, "Version: 7.5.0.2"),
        (0, "Installation: /opt/mqm (Installation1), Default: NO"),
    ]
    assert expected == actual

    # Override-does-not-match configuration
    params = {
        "mapped_states": [("running_as_standby", 2)],
        "mapped_states_default": 3,
    }
    actual = list(check.run_check("THE.ENDED.ONE", params, parsed))
    expected = [
        (3, "Status: ENDED PRE-EMPTIVELY"),
        (0, "Version: 7.5.0.2"),
        (0, "Installation: /opt/mqm (Installation1), Default: NO"),
    ]
    assert expected == actual
Beispiel #20
0
def test_check_single_instance_running():
    lines = """\
QMNAME(THE.LOCAL.ONE)                                     STATUS(RUNNING) DEFAULT(NO) STANDBY(NOT PERMITTED) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(8.0.0.6)
   INSTANCE(sb112233) MODE(ACTIVE)
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)

    attrs = parsed["THE.LOCAL.ONE"]
    assert attrs["QMNAME"] == "THE.LOCAL.ONE"
    assert attrs["STATUS"] == "RUNNING"

    params: Dict[str, Any] = {}
    actual = list(check.run_check("THE.LOCAL.ONE", params, parsed))
    expected = [
        (0, "Status: RUNNING"),
        (0, "Version: 8.0.0.6"),
        (0, "Installation: /opt/mqm (Installation1), Default: NO"),
        (0, "Single-Instance: sb112233=ACTIVE"),
    ]
    assert expected == actual
Beispiel #21
0
def test_rdqm():
    lines = """\
QMNAME(THE.RDQM.ONE)                                      STATUS(RUNNING) DEFAULT(NO) STANDBY(NOT PERMITTED) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(9.1.0.4) HA(REPLICATED) DRROLE()
    INSTANCE(sb008877) MODE(ACTIVE)
QMNAME(THE.STANDBY.RDQM)                                  STATUS(RUNNING ELSEWHERE) DEFAULT(NO) STANDBY(NOT APPLICABLE) INSTNAME(Installation1) INSTPATH(/opt/mqm) INSTVER(9.2.0.0) HA(REPLICATED) DRROLE()
"""
    section = parse_info(lines, chr(10))
    check = Check(CHECK_NAME)
    parsed = check.run_parse(section)

    attrs = parsed["THE.RDQM.ONE"]
    assert attrs["QMNAME"] == "THE.RDQM.ONE"
    assert attrs["STATUS"] == "RUNNING"

    params: Dict[str, Any] = {}
    actual = list(check.run_check("THE.RDQM.ONE", params, parsed))
    expected = [
        (0, "Status: RUNNING"),
        (0, "Version: 9.1.0.4"),
        (0, "Installation: /opt/mqm (Installation1), Default: NO"),
        (0, "High availability: replicated, Instance: sb008877"),
    ]
    assert expected == actual
Beispiel #22
0
def run_test_on_parse(dataset, immu):
    """Test parse function

    If dataset has .info attribute and the check has parse function defined,
    test it, and return the result. Otherwise return None.
    If the .parsed attribute is present, it is compared to the result.
    """
    print("parse: %r" % (dataset.checkname,))
    info = getattr(dataset, "info", None)
    parsed_expected = getattr(dataset, "parsed", None)

    if info is None:
        return None

    immu.register(dataset.info, "info")
    try:
        main_check = Check(dataset.checkname)
        parse_function = main_check.info.get("parse_function")
    except MissingCheckInfoError:
        # this could be ok -
        # it just implies we don't have a parse function
        parse_function = None

    if parsed_expected is not None:
        # we *must* have a parse function in this case!
        assert parse_function, "%s has no parse function!" % (dataset.checkname,)
    elif not parse_function:  # we may not have one:
        return None

    parsed = main_check.run_parse(info)
    if parsed_expected is not None:
        assertEqual(parsed, parsed_expected, " parsed result ")

    immu.test(" after parse function ")
    immu.register(parsed, "parsed")

    return parsed
def test_fileinfo_min_max_age_levels():
    check = Check("prism_containers")

    item = "prism-item"
    parsed = check.run_parse([
        ["name", "usage", "capacity"],
        ["prism-item", "5", "10"],
    ])

    output_expected = [
        BasicCheckResult(
            0,
            "Total: 10.00 B",
        ),
        BasicCheckResult(
            1,
            "Used: 5.00 B (warn/crit at 4.00 B/6.00 B)",
            [
                PerfValue("fs_used", 5, 4, 6, None, None),
            ],
        ),
    ]

    # percent levels
    output_perc_levels = check.run_check(item, {"levels": (40.0, 60.0)},
                                         parsed)
    assertCheckResultsEqual(
        CheckResult(output_perc_levels),
        CheckResult(output_expected),
    )

    # absolute levels
    output_abs_levels = check.run_check(item, {"levels": (4, 6)}, parsed)
    assertCheckResultsEqual(
        CheckResult(output_abs_levels),
        CheckResult(output_expected),
    )
Beispiel #24
0
def test_wmi_cpu_load_discovery(info, item, expected_item_data):
    check = Check("f5_bigip_vserver")
    assert sorted(check.run_parse(info)[item].items()) == sorted(
        expected_item_data.items())
Beispiel #25
0
def test_check_functions_perfdata(info, discovered, checked):
    check = Check("lnx_thermal")
    parsed = check.run_parse(info)
    for (item, _params), result in zip(discovered, checked):
        assert check.run_check(item, {}, parsed) == result
def test_mkbackup_parse(info):
    check = Check("mkbackup")
    check.run_parse(info)
Beispiel #27
0
def test_ceph_df_octopus_discovery(info, result):
    check = Check("ceph_df")
    parsed = check.run_parse(info)
    assert sorted(check.run_discovery(parsed)) == result
def test_docker_container_diskstat_discovery(info, discovery_expected):
    check = Check('docker_container_diskstat')
    parsed = check.run_parse(info)
    discovery_actual = DiscoveryResult(check.run_discovery(parsed))
    assertDiscoveryResultsEqual(check, discovery_actual, discovery_expected)
Beispiel #29
0
def test_parse_and_discovery_function(info, result):
    check = Check("lnx_thermal")
    parsed = check.run_parse(info)
    discovery = DiscoveryResult(check.run_discovery(parsed))
    assertDiscoveryResultsEqual(check, discovery, DiscoveryResult(result))
Beispiel #30
0
def test_zfsget_discovery(info, expected_discovery_result):
    check_zfsget = Check("zfsget")
    discovery_result = DiscoveryResult(
        check_zfsget.run_discovery(check_zfsget.run_parse(info)))
    assertDiscoveryResultsEqual("zfsget", discovery_result,
                                DiscoveryResult(expected_discovery_result))