1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "config/configcompiler.hpp"
4 #include "config/configitem.hpp"
5 #include "base/application.hpp"
6 #include "base/loader.hpp"
7 #include "icingaapplication-fixture.hpp"
8 #include <BoostTestTargetConfig.h>
10 using namespace icinga;
12 struct LivestatusFixture
16 // ensure IcingaApplication is initialized before we try to add config
17 IcingaApplicationFixture icinga;
19 BOOST_TEST_MESSAGE("Preparing config objects...");
21 ConfigItem::RunWithActivationContext(new Function("CreateTestObjects", CreateTestObjects));
24 static void CreateTestObjects()
26 String config = R"CONFIG(
27 object CheckCommand "dummy" {
31 object Host "test-01" {
33 check_command = "dummy"
36 object Host "test-02" {
38 check_command = "dummy"
41 apply Service "livestatus" {
42 check_command = "dummy"
43 notes = "test livestatus"
44 assign where match("test-*", host.name)
48 std::unique_ptr<Expression> expr = ConfigCompiler::CompileText("<livestatus>", config);
49 expr->Evaluate(*ScriptFrame::GetCurrentFrame());
53 BOOST_GLOBAL_FIXTURE(LivestatusFixture);