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

Function AssertCheckableRedundancyGroup

test/icinga-dependencies.cpp:39–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39static void AssertCheckableRedundancyGroup(
40 Checkable::Ptr checkable,
41 std::size_t dependencyCount,
42 std::size_t groupCount,
43 std::size_t totalDependenciesCount
44)
45{
46 BOOST_CHECK_MESSAGE(
47 dependencyCount == checkable->GetDependencies().size(),
48 "Dependency count mismatch for '" << checkable->GetName() << "' - expected=" << dependencyCount << "; got="
49 << checkable->GetDependencies().size()
50 );
51 auto dependencyGroups(checkable->GetDependencyGroups());
52 BOOST_CHECK_MESSAGE(
53 groupCount == dependencyGroups.size(),
54 "Dependency group count mismatch for '" << checkable->GetName() << "' - expected=" << groupCount
55 << "; got=" << dependencyGroups.size()
56 );
57
58 for (auto& dependencyGroup : dependencyGroups) {
59 BOOST_CHECK_MESSAGE(
60 totalDependenciesCount == dependencyGroup->GetDependenciesCount(),
61 "Dependency group '" << dependencyGroup->GetRedundancyGroupName() << "' and Checkable '" << checkable->GetName()
62 << "' total dependencies count mismatch - expected=" << totalDependenciesCount << "; got="
63 << dependencyGroup->GetDependenciesCount()
64 );
65 }
66
67 if (groupCount > 0) {
68 BOOST_REQUIRE_MESSAGE(!dependencyGroups.empty(), "Checkable '" << checkable->GetName() << "' should have at least one dependency group.");
69 }
70}
71
72static std::vector<DependencyGroup::Ptr> ExtractGroups(const Checkable::Ptr& checkable)
73{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 6

GetDependenciesMethod · 0.80
GetDependencyGroupsMethod · 0.80
GetDependenciesCountMethod · 0.80
sizeMethod · 0.45
GetNameMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected