]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1515] Addressed known bugs
authorFrancis Dupont <fdupont@isc.org>
Fri, 2 Apr 2021 11:59:56 +0000 (13:59 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 9 Apr 2021 14:32:06 +0000 (16:32 +0200)
src/bin/d2/tests/d2_update_mgr_unittests.cc
src/bin/d2/tests/testdata/d2_cfg_tests.json
src/hooks/dhcp/stat_cmds/tests/stat_cmds_unittest.cc
src/lib/cc/tests/data_unittests.cc
src/lib/database/tests/database_connection_unittest.cc
src/lib/dhcpsrv/tests/srv_config_unittest.cc
src/lib/process/tests/log_parser_unittests.cc

index c78c4f4dad1b5c4ebeba308e832731bc82a456cd..a89de3e27369c5f0d95336e27dc385848634e366 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -102,7 +102,7 @@ public:
         " \"use-conflict-resolution\" : true "
         "}";
 
-        const char* dhcids[] = { "111111", "222222", "333333", "444444"};
+        const char* dhcids[] = { "111111", "222222", "333333", "444444" };
         canned_count_ = 4;
         for (int i = 0; i < canned_count_; i++) {
             dhcp_ddns::NameChangeRequestPtr ncr = NameChangeRequest::
@@ -122,27 +122,27 @@ public:
                   "\"port\" : 88 , "
                   "\"tsig-keys\": [] ,"
                   "\"forward-ddns\" : {"
-                  "\"ddns-domains\": [ "
-                  "{ \"name\": \"example.com.\" , "
-                  "  \"dns-servers\" : [ "
-                  "  { \"ip-address\": \"127.0.0.1\", \"port\" : 5301  } "
-                  "  ] },"
-                  "{ \"name\": \"org.\" , "
-                  "  \"dns-servers\" : [ "
-                  "  { \"ip-address\": \"127.0.0.1\" } "
+                  " \"ddns-domains\": [ "
+                  "  { \"name\": \"example.com.\" , "
+                  "   \"dns-servers\" : [ "
+                  "    { \"ip-address\": \"127.0.0.1\", \"port\" : 5301  } "
+                  "   ] },"
+                  "  { \"name\": \"org.\" , "
+                  "   \"dns-servers\" : [ "
+                  "    { \"ip-address\": \"127.0.0.1\" } "
+                  "    ] }"
                   "  ] }, "
-                  "] }, "
                   "\"reverse-ddns\" : { "
-                  "\"ddns-domains\": [ "
-                  "{ \"name\": \"1.168.192.in-addr.arpa.\" , "
-                  "  \"dns-servers\" : [ "
-                  "  { \"ip-address\": \"127.0.0.1\", \"port\" : 5301 } "
-                  "  ] }, "
-                  "{ \"name\": \"2.0.3.0.8.B.D.0.1.0.0.2.ip6.arpa.\" , "
-                  "  \"dns-servers\" : [ "
-                  "  { \"ip-address\": \"127.0.0.1\" } "
-                  "  ] } "
-                  "] } }";
+                  " \"ddns-domains\": [ "
+                  "  { \"name\": \"1.168.192.in-addr.arpa.\" , "
+                  "   \"dns-servers\" : [ "
+                  "    { \"ip-address\": \"127.0.0.1\", \"port\" : 5301 } "
+                  "   ] }, "
+                  "  { \"name\": \"2.0.3.0.8.B.D.0.1.0.0.2.ip6.arpa.\" , "
+                  "   \"dns-servers\" : [ "
+                  "    { \"ip-address\": \"127.0.0.1\" } "
+                  "    ] } "
+                  "  ] } }";
 
         // If this configuration fails to parse most tests will fail.
         ASSERT_TRUE(fromJSON(canned_config_));
index 49c972dc6a56e1f2d9b08e2a7fc007a519a2608c..487b82dd11bc8598991fcd785a0a4449dd1ab533 100644 (file)
             "name" : "first.key",
             "algorithm" : "HMAC-MD5",
             "secret" : "LSWXnfkKZjdPJI5QxlpnfQ=="
-            }
-            ,{
+            },
+            {
             "name" : "first.key",
             "algorithm" : "HMAC-MD5",
             "secret" : "LSWXnfkKZjdPJI5QxlpnfQ=="
             "algorithm" : "HMAC-MD5",
             "digest-bits" : 72,
             "secret" : "LSWXnfkKZjdPJI5QxlpnfQ=="
-            },
+            }
         ]
     }
 }
             "algorithm" : "HMAC-SHA1",
             "digest-bits" : 72,
             "secret" : "hRrp29wzUv3uzSNRLlY68w=="
-            },
+            }
         ]
     }
 }
             "algorithm" : "HMAC-SHA224",
             "digest-bits" : 104,
             "secret" : "bZEG7Ow8OgAUPfLWV3aAUQ=="
-            },
+            }
         ]
     }
 }
             "algorithm" : "hmac-sha256",
             "digest-bits" : 120,
             "secret" : "bjF4hYhTfQ5MX0siagelsw=="
-            },
+            }
         ]
     }
 }
             "algorithm" : "hmac-sha384",
             "digest-bits" : 184,
             "secret" : "Gwk53fvy3CmbupoI9TgigA=="
-            },
+            }
         ]
     }
 }
index fbb8ad1ce749a72a2f6f9ea93163109ba843a8b7..58e5fcefa3953e1dcd68d7b503897d97a1c8d94b 100644 (file)
@@ -858,7 +858,7 @@ TEST_F(StatCmdsTest, statLease4GetValid) {
         "        \"assigned-addresses\", \"declined-addresses\"\n"
         "   ],\n"
         "   \"rows\": [\n"
-        "       [ 20, 16, 10, 3, 0 ],\n"
+        "       [ 20, 16, 10, 3, 0 ]\n"
         "   ],\n"
         "   \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
         "}\n"
@@ -885,7 +885,7 @@ TEST_F(StatCmdsTest, statLease4GetValid) {
         "   \"rows\": [\n"
         "       [ 10, 256, 300, 2, 3 ],\n"
         "       [ 20, 16, 10, 3, 0 ],\n"
-        "       [ 30, 256, 0, 0, 0 ],\n"
+        "       [ 30, 256, 0, 0, 0 ]\n"
         "   ],\n"
         "   \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
         "}\n"
@@ -912,7 +912,7 @@ TEST_F(StatCmdsTest, statLease4GetValid) {
         "   \"rows\": [\n"
         "       [ 20, 16, 10, 3, 0 ],\n"
         "       [ 30, 256, 0, 0, 0 ],\n"
-        "       [ 40, 16, 4, 4, 0 ],\n"
+        "       [ 40, 16, 4, 4, 0 ]\n"
         "   ],\n"
         "   \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
         "}\n"
@@ -939,7 +939,7 @@ TEST_F(StatCmdsTest, statLease4GetValid) {
         "   \"rows\": [\n"
         "       [ 30, 256, 0, 0, 0 ],\n"
         "       [ 40, 16, 4, 4, 0 ],\n"
-        "       [ 50, 256, 2, 1, 1 ],\n"
+        "       [ 50, 256, 2, 1, 1 ]\n"
         "   ],\n"
         "   \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
         "}\n"
@@ -965,7 +965,7 @@ TEST_F(StatCmdsTest, statLease4GetValid) {
         "   ],\n"
         "   \"rows\": [\n"
         "       [ 30, 256, 0, 0, 0 ],\n"
-        "       [ 40, 16, 4, 4, 0 ],\n"
+        "       [ 40, 16, 4, 4, 0 ]\n"
         "   ],\n"
         "   \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
         "}\n"
@@ -1314,7 +1314,7 @@ TEST_F(StatCmdsTest, statLease6GetValid) {
         "   \"rows\": [\n"
         "       [ 10, 65536, 10000, 2, 3, 0, 0, 0 ],\n"
         "       [ 20, 16777216, 10, 3, 0, 0, 0, 0 ],\n"
-        "       [ 30, 16, 2, 1, 1, 65536, 4, 3 ],\n"
+        "       [ 30, 16, 2, 1, 1, 65536, 4, 3 ]\n"
         "   ],\n"
         "   \"timestamp\": \"2018-05-04 15:03:37.000000\" }\n"
         "}\n"
@@ -1472,10 +1472,7 @@ TEST_F(StatCmdsTest, statLease6GetSubnetsNotFound) {
                     (*test).exp_response_, (*test).exp_result_json);
         }
     }
-
 }
 
-
-
 } // end of anonymous namespace
 
index 41b20d46036c745f88ba45ed0c986636cebfeeb1..fe84693e2c2e2bd6c1e65319ab5cc889ea4707f4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2009-2021 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -163,7 +163,9 @@ TEST(Element, from_and_to_json) {
 
     // some json specific format tests, here the str() output is
     // different from the string input
-    EXPECT_EQ("100", Element::fromJSON("+100")->str());
+    // +100 is incorrect according to the ECMA 404 JSON standard.
+    // Keeping it as it will be reversed.
+    // EXPECT_EQ("100", Element::fromJSON("+100")->str());
     EXPECT_EQ("100.0", Element::fromJSON("1e2")->str());
     EXPECT_EQ("100.0", Element::fromJSON("+1e2")->str());
     EXPECT_EQ("-100.0", Element::fromJSON("-1e2")->str());
index df43a56a42a7768c413f13f27bf4234c38b8c733..d3424f58f258aee867b39f95b6ed539ad15c9a7b 100644 (file)
@@ -529,7 +529,6 @@ TEST(DatabaseConnection, toElementDbAccessStringValid) {
         "\"consistency\": \"quorum\", \n"
         "\"on-fail\": \"stop-retry-exit\", \n"
         "\"serial-consistency\": \"serial\", \n"
-        "\"host\": \"host_str\", \n"
         "\"keyspace\": \"keyspace_str\", \n"
         "\"lfc-interval\" : 100, \n"
         "\"host\": \"whatevah\", \n"
index e2c9c2f5f649a4e934c770ba130aced2a5200386..915bb50540f5e7ef0505cdf929875f425b854d7d 100644 (file)
@@ -529,7 +529,6 @@ TEST_F(SrvConfigTest, unparse) {
     std::string header6 = "{\n\"Dhcp6\": {\n";
 
     std::string defaults = "\"decline-probation-period\": 0,\n";
-    defaults += "\"dhcp4o6-port\": 0,\n";
     defaults += "\"interfaces-config\": { \"interfaces\": [ ],\n";
     defaults += " \"re-detect\": false },\n";
     defaults += "\"option-def\": [ ],\n";
@@ -545,8 +544,7 @@ TEST_F(SrvConfigTest, unparse) {
 
     defaults += conf.getD2ClientConfig()->toElement()->str() + ",\n";
 
-    std::string defaults4 = "\"echo-client-id\": true,\n";
-    defaults4 += "\"shared-networks\": [ ],\n";
+    std::string defaults4 = "\"shared-networks\": [ ],\n";
     defaults4 += "\"subnet4\": [ ],\n";
     defaults4 += "\"host-reservation-identifiers\": ";
     defaults4 += "[ \"hw-address\", \"duid\", \"circuit-id\", \"client-id\" ],\n";
index 6985f1e1d6ce18f433a6553b27d371d6cbe9d2b8..14acdbd1a180d2760645e42bf69152d933d53d52 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019,2021 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2021 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -376,6 +376,7 @@ TEST_F(LoggingTest, logRotate) {
 // Verifies that a valid output option,'pattern' paress correctly.
 TEST_F(LoggingTest, validPattern) {
 
+    // Note the backslash must be doubled in the pattern definition.
     const char* config_txt =
     "{ \"loggers\": ["
     "    {"
@@ -383,7 +384,7 @@ TEST_F(LoggingTest, validPattern) {
     "        \"output_options\": ["
     "            {"
     "                \"output\": \"stdout\","
-    "                \"pattern\": \"mylog %m\n\""
+    "                \"pattern\": \"mylog %m\\n\""
     "            }"
     "        ],"
     "        \"severity\": \"INFO\""