Exemplo n.º 1
0
TEST_F(EventsConfigParserPluginTests, test_get_event) {
  // Reset the schedule in case other tests were modifying.
  auto c = Config::getInstance();
  c.clearSchedule();

  // Generate content to update/add to the config.
  std::string content;
  auto s = readFile(kTestDataPath + "test_parse_items.conf", content);
  EXPECT_TRUE(s.ok());
  std::map<std::string, std::string> config;
  config["awesome"] = content;

  // Send our synthetic config.
  s = c.update(config);
  EXPECT_TRUE(s.ok());
  EXPECT_EQ(s.toString(), "OK");

  // Retrieve a basic events parser.
  auto plugin = Config::getInstance().getParser("events");
  EXPECT_TRUE(plugin != nullptr);
  const auto& data = plugin->getData();

  EXPECT_EQ(data.count("events"), 1U);
  EXPECT_GT(data.get_child("events").count("environment_variables"), 0U);
  for (const auto& var : data.get_child("events.environment_variables")) {
    EXPECT_TRUE(var.second.data() == "foo" || var.second.data() == "bar");
  }
}
Exemplo n.º 2
0
Scheduler::Scheduler()
{
  clearQueue();
  clearSchedule();
}