summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2017-01-19 16:26:24 +0100
committerFrancis Dupont <fdupont@isc.org>2017-01-19 16:26:24 +0100
commitef6d28a4b7de9f8d718594f957932fd4eb11dcae (patch)
tree5c603a8381c6e19c52ef84cf38ee424af1b64a40
parent[master] Updated git hash (diff)
downloadkea-ef6d28a4b7de9f8d718594f957932fd4eb11dcae.tar.xz
kea-ef6d28a4b7de9f8d718594f957932fd4eb11dcae.zip
[5113] Added an emptyInterfaceConfig unit test (for DHCPv4 and DHCPv6)
-rw-r--r--src/bin/dhcp4/tests/config_parser_unittest.cc15
-rw-r--r--src/bin/dhcp6/tests/config_parser_unittest.cc16
2 files changed, 31 insertions, 0 deletions
diff --git a/src/bin/dhcp4/tests/config_parser_unittest.cc b/src/bin/dhcp4/tests/config_parser_unittest.cc
index 5cccb18499..0eb4823a97 100644
--- a/src/bin/dhcp4/tests/config_parser_unittest.cc
+++ b/src/bin/dhcp4/tests/config_parser_unittest.cc
@@ -614,6 +614,21 @@ TEST_F(Dhcp4ParserTest, bogusCommand) {
EXPECT_THROW(parseDHCP4("{\"bogus\": 5}"), Dhcp4ParseError);
}
+/// The goal of this test is to verify empty interface-config is accepted.
+TEST_F(Dhcp4ParserTest, emptyInterfaceConfig) {
+
+ ConstElementPtr json;
+ EXPECT_NO_THROW(json = parseDHCP4("{ \"rebind-timer\": 2000, "
+ "\"renew-timer\": 1000, "
+ "\"valid-lifetime\": 4000 }"));
+
+ ConstElementPtr status;
+ EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
+
+ // returned value should be 0 (success)
+ checkResult(status, 0);
+}
+
/// The goal of this test is to verify if wrongly defined subnet will
/// be rejected. Properly defined subnet must include at least one
/// pool definition.
diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc
index fc479fc12e..8a3ec91ffa 100644
--- a/src/bin/dhcp6/tests/config_parser_unittest.cc
+++ b/src/bin/dhcp6/tests/config_parser_unittest.cc
@@ -751,6 +751,22 @@ TEST_F(Dhcp6ParserTest, bogusCommand) {
EXPECT_THROW(parseDHCP6("{\"bogus\": 5}"), Dhcp6ParseError);
}
+/// The goal of this test is to verify empty interface-config is accepted.
+TEST_F(Dhcp6ParserTest, emptyInterfaceConfig) {
+
+ ConstElementPtr json;
+ EXPECT_NO_THROW(json = parseDHCP6("{ \"preferred-lifetime\": 3000,"
+ "\"rebind-timer\": 2000, "
+ "\"renew-timer\": 1000, "
+ "\"valid-lifetime\": 4000 }"));
+
+ ConstElementPtr status;
+ EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
+
+ // returned value should be 0 (success)
+ checkResult(status, 0);
+}
+
/// The goal of this test is to verify if configuration without any
/// subnets defined can be accepted.
TEST_F(Dhcp6ParserTest, emptySubnet) {