def scenario_fixture(monkeypatch): test_hosts = ["ds-test-host1", "ds-test-host2", "ds-test-node1", "ds-test-node2"] ts = Scenario() if is_enterprise_repo(): ts.set_option("monitoring_core", "cmc") else: ts.set_option("monitoring_core", "nagios") for h in test_hosts: ts.add_host(h) ts.set_option("ipaddresses", dict((h, "127.0.0.1") for h in test_hosts)) ts.add_cluster("ds-test-cluster1", nodes=["ds-test-node1", "ds-test-node2"]) ts.fake_standard_linux_agent_output(*test_hosts) return ts.apply(monkeypatch)
def test_do_discovery(monkeypatch): ts = Scenario().add_host("test-host", ipaddress="127.0.0.1") ts.fake_standard_linux_agent_output("test-host") ts.apply(monkeypatch) with cmk_debug_enabled(): discovery.do_discovery( arg_hostnames={"test-host"}, selected_sections=NO_SELECTION, run_only_plugin_names=None, arg_only_new=False, ) services = autochecks.parse_autochecks_file("test-host", config.service_description) found = {(s.check_plugin_name, s.item): s.service_labels.to_dict() for s in services} assert found == _expected_services store = DiscoveredHostLabelsStore("test-host") assert store.load() == _expected_host_labels