コード例 #1
0
def test_analyse_host(monkeypatch):
    automation = automations.AutomationAnalyseHost()

    ts = Scenario()
    ts.add_host("test-host")
    ts.set_option(
        "host_labels",
        {
            "test-host": {
                "explicit": "ding",
            },
        },
    )
    ts.apply(monkeypatch)

    assert automation.execute(["test-host"]) == AnalyseHostResult(
        label_sources={
            "cmk/site": "discovered",
            "explicit": "explicit"
        },
        labels={
            "cmk/site": "NO_SITE",
            "explicit": "ding"
        },
    )
コード例 #2
0
def test_analyse_host(monkeypatch):
    automation = automations.AutomationAnalyseHost()

    ts = Scenario().add_host("test-host")
    ts.set_option("host_labels", {
        "test-host": {
            "explicit": "ding",
        },
    })
    ts.apply(monkeypatch)

    assert automation.execute(["test-host"]) == {
        "labels": {
            "explicit": "ding"
        },
        "label_sources": {
            "explicit": "explicit"
        },
    }