From: Tomek Mrugalski Date: Wed, 2 Sep 2015 11:37:34 +0000 (+0200) Subject: [3983] Unit-tests for incorrect decline-probation-period added. X-Git-Tag: fd4o6_base~11^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84568421ed25ffb53a0848581a4e61078a17beee;p=thirdparty%2Fkea.git [3983] Unit-tests for incorrect decline-probation-period added. --- diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc index 91c816a7d9..46ee547d10 100644 --- a/src/bin/dhcp4/tests/config_parser_unittest.cc +++ b/src/bin/dhcp4/tests/config_parser_unittest.cc @@ -3692,5 +3692,24 @@ TEST_F(Dhcp4ParserTest, declineTimer) { CfgMgr::instance().getStagingCfg()->getDeclinePeriod()); } +/// Check that an incorrect decline-probation-period value will be caught. +TEST_F(Dhcp4ParserTest, declineTimerError) { + ConstElementPtr status; + + string config = "{ " + genIfaceConfig() + "," + + "\"decline-probation-period\": \"soon\"," + "\"subnet4\": [ ]" + "}"; + + ElementPtr json = Element::fromJSON(config); + + EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json)); + + // returned value should be 1 (error) + checkResult(status, 1); + + // Check that the error contains error position. + EXPECT_TRUE(errorContainsPosition(status, "")); +} } diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc index 6e9f738348..26c9732903 100644 --- a/src/bin/dhcp6/tests/config_parser_unittest.cc +++ b/src/bin/dhcp6/tests/config_parser_unittest.cc @@ -4026,6 +4026,25 @@ TEST_F(Dhcp6ParserTest, declineTimer) { CfgMgr::instance().getStagingCfg()->getDeclinePeriod()); } +/// Check that an incorrect decline-probation-period value will be caught. +TEST_F(Dhcp6ParserTest, declineTimerError) { + ConstElementPtr status; + + string config = "{ " + genIfaceConfig() + "," + + "\"decline-probation-period\": \"soon\"," + "\"subnet6\": [ ]" + "}"; + + ElementPtr json = Element::fromJSON(config); + + EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json)); + + // returned value should be 1 (error) + checkResult(status, 1); + + // Check that the error contains error position. + EXPECT_TRUE(errorContainsPosition(status, "")); +} };