summaryrefslogtreecommitdiffstats
path: root/src/bin/dhcp6/tests
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2020-09-05 22:12:24 +0200
committerFrancis Dupont <fdupont@isc.org>2020-09-21 12:36:02 +0200
commit63f5a72421cbac4e4b7eb48430bf561a0911ab57 (patch)
treeef314b6a49cccaa4229ce22477de44b7552addfd /src/bin/dhcp6/tests
parent[#1102] regen bison (diff)
downloadkea-63f5a72421cbac4e4b7eb48430bf561a0911ab57.tar.xz
kea-63f5a72421cbac4e4b7eb48430bf561a0911ab57.zip
[#1102] Checkpoint: finished code
Diffstat (limited to 'src/bin/dhcp6/tests')
-rw-r--r--src/bin/dhcp6/tests/classify_unittests.cc3
-rw-r--r--src/bin/dhcp6/tests/config_parser_unittest.cc3
-rw-r--r--src/bin/dhcp6/tests/parser_unittest.cc21
3 files changed, 21 insertions, 6 deletions
diff --git a/src/bin/dhcp6/tests/classify_unittests.cc b/src/bin/dhcp6/tests/classify_unittests.cc
index 51d7e8674e..910ff34985 100644
--- a/src/bin/dhcp6/tests/classify_unittests.cc
+++ b/src/bin/dhcp6/tests/classify_unittests.cc
@@ -1619,7 +1619,6 @@ TEST_F(ClassifyTest, precedencePool) {
"\"interfaces-config\": {"
" \"interfaces\": [ \"*\" ]"
"},"
- "\"valid-lifetime\": 600,"
"\"client-classes\": ["
" {"
" \"name\": \"all\","
@@ -1702,7 +1701,6 @@ TEST_F(ClassifyTest, precedenceSubnet) {
"\"interfaces-config\": {"
" \"interfaces\": [ \"*\" ]"
"},"
- "\"valid-lifetime\": 600,"
"\"client-classes\": ["
" {"
" \"name\": \"all\","
@@ -1786,7 +1784,6 @@ TEST_F(ClassifyTest, precedenceNetwork) {
"\"interfaces-config\": {"
" \"interfaces\": [ \"*\" ]"
"},"
- "\"valid-lifetime\": 600,"
"\"client-classes\": ["
" {"
" \"name\": \"all\","
diff --git a/src/bin/dhcp6/tests/config_parser_unittest.cc b/src/bin/dhcp6/tests/config_parser_unittest.cc
index c01ce50159..54d2d53778 100644
--- a/src/bin/dhcp6/tests/config_parser_unittest.cc
+++ b/src/bin/dhcp6/tests/config_parser_unittest.cc
@@ -4877,7 +4877,6 @@ TEST_F(Dhcp6ParserTest, d2ClientConfigValid) {
string config_str = "{ " + genIfaceConfig() + ","
"\"preferred-lifetime\": 3000,"
- "\"valid-lifetime\": 4000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet6\": [ { "
@@ -4947,7 +4946,6 @@ TEST_F(Dhcp6ParserTest, d2ClientConfigMoveToGlobal) {
string config_str = "{ " + genIfaceConfig() + ","
"\"preferred-lifetime\": 3000,"
- "\"valid-lifetime\": 4000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet6\": [ { "
@@ -5025,7 +5023,6 @@ TEST_F(Dhcp6ParserTest, d2ClientConfigBoth) {
string config_str = "{ " + genIfaceConfig() + ","
"\"preferred-lifetime\": 3000,"
- "\"valid-lifetime\": 4000,"
"\"rebind-timer\": 2000, "
"\"renew-timer\": 1000, "
"\"subnet6\": [ { "
diff --git a/src/bin/dhcp6/tests/parser_unittest.cc b/src/bin/dhcp6/tests/parser_unittest.cc
index 03d856f844..30cc57ca31 100644
--- a/src/bin/dhcp6/tests/parser_unittest.cc
+++ b/src/bin/dhcp6/tests/parser_unittest.cc
@@ -525,6 +525,12 @@ TEST(ParserTest, errors) {
"<string>:1.3: syntax error, unexpected {, "
"expecting end of file");
+ // duplicate in map
+ testError("{ \"foo\": 1, \"foo\": true }\n",
+ Parser6Context::PARSER_JSON,
+ "<string>:1:13: duplicate foo entries in "
+ "JSON map (previous at <string>:1:10)");
+
// bad commas
testError("{ , }\n",
Parser6Context::PARSER_JSON,
@@ -606,6 +612,21 @@ TEST(ParserTest, errors) {
" \"comment\": \"second\" }}\n",
Parser6Context::PARSER_DHCP6,
"<string>:2.23: syntax error, unexpected \",\", expecting }");
+
+ // duplicate of not string entries
+ testError("{ \"Dhcp6\":{\n"
+ " \"subnet6\": [],\n"
+ " \"subnet6\": [] }}\n",
+ Parser6Context::PARSER_DHCP6,
+ "<string>:3:2: duplicate subnet6 entries in "
+ "Dhcp6 map (previous at <string>:2:2)");
+
+ // duplicate of string entries
+ testError("{ \"data\": \"foo\",\n"
+ " \"data\": \"bar\" }\n",
+ Parser6Context::PARSER_OPTION_DATA,
+ "<string>:2:2: duplicate data entries in "
+ "option-data map (previous at <string>:1:11)");
}
// Check unicode escapes