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

Function BOOST_AUTO_TEST_CASE

test/livestatus.cpp:49–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47BOOST_AUTO_TEST_SUITE(livestatus)
48
49BOOST_AUTO_TEST_CASE(hosts)
50{
51 BOOST_TEST_MESSAGE( "Querying Livestatus...");
52
53 std::vector<String> lines;
54 lines.emplace_back("GET hosts");
55 lines.emplace_back("Columns: host_name address check_command");
56 lines.emplace_back("OutputFormat: json");
57 lines.emplace_back("\n");
58
59 /* use our query helper */
60 String output = LivestatusQueryHelper(lines);
61
62 Array::Ptr query_result = JsonDecode(output);
63
64 /* the outer elements */
65 BOOST_CHECK(query_result->GetLength() > 1);
66
67 Array::Ptr res1 = query_result->Get(0);
68 Array::Ptr res2 = query_result->Get(1);
69
70 /* results are non-deterministic and not sorted by livestatus */
71 BOOST_CHECK(res1->Contains("test-01") || res2->Contains("test-01"));
72 BOOST_CHECK(res1->Contains("test-02") || res2->Contains("test-02"));
73 BOOST_CHECK(res1->Contains("127.0.0.1") || res2->Contains("127.0.0.1"));
74 BOOST_CHECK(res1->Contains("127.0.0.2") || res2->Contains("127.0.0.2"));
75
76 BOOST_TEST_MESSAGE("Done with testing livestatus hosts...");
77}
78
79BOOST_AUTO_TEST_CASE(services)
80{

Callers

nothing calls this directly

Calls 4

LivestatusQueryHelperFunction · 0.85
GetLengthMethod · 0.45
GetMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected