def test__discover_host_labels_and_services_on_realhost( realhost_scenario, discovery_test_case): scenario = realhost_scenario discovery_parameters = discovery_test_case.parameters # we're depending on the changed host labels: _ = discovery.analyse_host_labels( host_name=scenario.hostname, ipaddress=scenario.ipaddress, parsed_sections_broker=scenario.parsed_sections_broker, discovery_parameters=discovery_parameters, ) with cmk_debug_enabled(): discovered_services = ( [] if discovery_parameters.only_host_labels else discovery._discovered_services._discover_services( host_name=scenario.hostname, ipaddress=scenario.ipaddress, parsed_sections_broker=scenario.parsed_sections_broker, discovery_parameters=discovery_parameters, run_plugin_names=EVERYTHING, )) services = {(s.check_plugin_name, s.item) for s in discovered_services} assert services == discovery_test_case.expected_services
def test__perform_host_label_discovery_on_realhost(realhost_scenario, discovery_test_case): scenario = realhost_scenario discovery_parameters = discovery_test_case.parameters with cmk_debug_enabled(): host_label_result = discovery.analyse_host_labels( host_name=scenario.hostname, ipaddress=scenario.ipaddress, parsed_sections_broker=scenario.parsed_sections_broker, discovery_parameters=discovery_parameters, ) assert host_label_result.vanished == discovery_test_case.on_realhost.expected_vanished_host_labels assert host_label_result.old == discovery_test_case.on_realhost.expected_old_host_labels assert host_label_result.new == discovery_test_case.on_realhost.expected_new_host_labels assert DiscoveredHostLabelsStore( scenario.hostname).load() == discovery_test_case.on_realhost.expected_stored_labels