Commit d316d6c2 authored by Francis Dupont's avatar Francis Dupont

[#916] Added tests

parent 3b886e7f
......@@ -28,12 +28,13 @@ public:
/// @brief Constructor.
/// Note the constructor passes in the static DStubController instance
/// method.
DStubControllerTest() : DControllerTest (DStubController::instance) {
DStubControllerTest() : DControllerTest(DStubController::instance) {
controller_ = boost::dynamic_pointer_cast<DStubController>
(DControllerTest::
getController());
}
/// @brief The controller.
DStubControllerPtr controller_;
};
......@@ -287,6 +288,28 @@ TEST_F(DStubControllerTest, configUpdateTests) {
EXPECT_EQ(1, rcode);
}
// Tests that handleOtherObjects behaves as expected.
TEST_F(DStubControllerTest, handleOtherObjects) {
using namespace isc::data;
// A bad config.
ElementPtr config = Element::createMap();
config->set(controller_->getAppName(), Element::create(1));
config->set("foo", Element::create(2));
config->set("bar", Element::create(3));
// Check the error message.
std::string errmsg;
EXPECT_NO_THROW(errmsg = controller_->handleOtherObjects(config));
EXPECT_EQ(" contains unsupported 'bar' parameter (and 'foo')", errmsg);
// Retry with no error.
config = Element::createMap();
config->set(controller_->getAppName(), Element::create(1));
EXPECT_NO_THROW(errmsg = controller_->handleOtherObjects(config));
EXPECT_TRUE(errmsg.empty());
}
// Tests that registered signals are caught and handled.
TEST_F(DStubControllerTest, ioSignals) {
// Tell test controller just to record the signals, don't call the
......@@ -355,8 +378,6 @@ TEST_F(DStubControllerTest, alternateParsing) {
EXPECT_EQ(SIGHUP, signals[0]);
}
// Tests that the original configuration is replaced after a SIGHUP triggered
// reconfiguration succeeds.
TEST_F(DStubControllerTest, validConfigReload) {
......
......@@ -190,6 +190,9 @@ public:
return (processed_signals_);
}
/// @brief Deals with other (i.e. not application name) global objects.
using DControllerBase::handleOtherObjects;
/// @brief Controls whether signals are processed in full or merely
/// recorded.
///
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment