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

Function GetTargetServicesHelper

test/config-apply.cpp:58–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58static void GetTargetServicesHelper(
59 const String& filter, const Dictionary::Ptr& constants, bool targeted, const std::vector<std::pair<String, String>>& services = {}
60)
61{
62 auto compiled (ConfigCompiler::CompileText("<test>", filter));
63 auto expr (RequireActualExpression(compiled));
64 std::vector<std::pair<const String*, const String*>> actualServices;
65
66 BOOST_CHECK_EQUAL(ApplyRule::GetTargetServices(expr, actualServices, constants), targeted);
67
68 if (targeted) {
69 std::vector<std::pair<String, String>> actualServiceNames;
70
71 actualServiceNames.reserve(actualServices.size());
72
73 for (auto s : actualServices) {
74 actualServiceNames.emplace_back(*s.first, *s.second);
75 }
76
77 BOOST_CHECK_EQUAL_COLLECTIONS(actualServiceNames.begin(), actualServiceNames.end(), services.begin(), services.end());
78 }
79}
80
81BOOST_AUTO_TEST_SUITE(config_apply)
82

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