MCPcopy Create free account
hub / github.com/Icinga/icinga2 / GetTargetHostsHelper

Function GetTargetHostsHelper

test/config-apply.cpp:35–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33};
34
35static void GetTargetHostsHelper(
36 const String& filter, const Dictionary::Ptr& constants, bool targeted, const std::vector<String>& hosts = {}
37)
38{
39 auto compiled (ConfigCompiler::CompileText("<test>", filter));
40 auto expr (RequireActualExpression(compiled));
41 std::vector<const String*> actualHosts;
42
43 BOOST_CHECK_EQUAL(ApplyRule::GetTargetHosts(expr, actualHosts, constants), targeted);
44
45 if (targeted) {
46 std::vector<String> actualHostNames;
47
48 actualHostNames.reserve(actualHosts.size());
49
50 for (auto h : actualHosts) {
51 actualHostNames.emplace_back(*h);
52 }
53
54 BOOST_CHECK_EQUAL_COLLECTIONS(actualHostNames.begin(), actualHostNames.end(), hosts.begin(), hosts.end());
55 }
56}
57
58static void GetTargetServicesHelper(
59 const String& filter, const Dictionary::Ptr& constants, bool targeted, const std::vector<std::pair<String, String>>& services = {}

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 4

RequireActualExpressionFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected