mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-29 13:07:50 +00:00
[#916] Added tests
This commit is contained in:
parent
3b886e7fb6
commit
d316d6c2bc
@ -28,12 +28,13 @@ public:
|
|||||||
/// @brief Constructor.
|
/// @brief Constructor.
|
||||||
/// Note the constructor passes in the static DStubController instance
|
/// Note the constructor passes in the static DStubController instance
|
||||||
/// method.
|
/// method.
|
||||||
DStubControllerTest() : DControllerTest (DStubController::instance) {
|
DStubControllerTest() : DControllerTest(DStubController::instance) {
|
||||||
controller_ = boost::dynamic_pointer_cast<DStubController>
|
controller_ = boost::dynamic_pointer_cast<DStubController>
|
||||||
(DControllerTest::
|
(DControllerTest::
|
||||||
getController());
|
getController());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief The controller.
|
||||||
DStubControllerPtr controller_;
|
DStubControllerPtr controller_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -287,6 +288,28 @@ TEST_F(DStubControllerTest, configUpdateTests) {
|
|||||||
EXPECT_EQ(1, rcode);
|
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.
|
// Tests that registered signals are caught and handled.
|
||||||
TEST_F(DStubControllerTest, ioSignals) {
|
TEST_F(DStubControllerTest, ioSignals) {
|
||||||
// Tell test controller just to record the signals, don't call the
|
// 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]);
|
EXPECT_EQ(SIGHUP, signals[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Tests that the original configuration is replaced after a SIGHUP triggered
|
// Tests that the original configuration is replaced after a SIGHUP triggered
|
||||||
// reconfiguration succeeds.
|
// reconfiguration succeeds.
|
||||||
TEST_F(DStubControllerTest, validConfigReload) {
|
TEST_F(DStubControllerTest, validConfigReload) {
|
||||||
|
@ -190,6 +190,9 @@ public:
|
|||||||
return (processed_signals_);
|
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
|
/// @brief Controls whether signals are processed in full or merely
|
||||||
/// recorded.
|
/// recorded.
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user