]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#488,!259] Correct unit tests failing after recent code updates.
authorMarcin Siodelski <marcin@isc.org>
Tue, 5 Mar 2019 11:03:45 +0000 (12:03 +0100)
committerMarcin Siodelski <marcin@isc.org>
Thu, 7 Mar 2019 13:00:35 +0000 (08:00 -0500)
src/bin/dhcp4/tests/get_config_unittest.cc
src/bin/dhcp6/tests/get_config_unittest.cc
src/lib/dhcpsrv/network.cc
src/lib/dhcpsrv/tests/cfg_shared_networks6_unittest.cc

index 9be8afaac4dab03a21855c00fe7bb66a8e43b1ce..355e8f71fcd10c0acf3ccbd15b90dffc25a02dfe 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2019 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
@@ -8286,7 +8286,8 @@ const char* UNPARSED_CONFIGS[] = {
 "                        \"subnet\": \"192.0.1.0/24\",\n"
 "                        \"valid-lifetime\": 7200\n"
 "                    }\n"
-"                ]\n"
+"                ],\n"
+"                \"valid-lifetime\": 7200\n"
 "            }\n"
 "        ],\n"
 "        \"subnet4\": [ ]\n"
index 810576f275b5f6c8fb7f0f8bf56b4ceb09c12498..561d4c183a11f5682d73d6e0f8fddfc78b3cf7bb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2019 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
@@ -7477,11 +7477,13 @@ const char* UNPARSED_CONFIGS[] = {
 "                \"comment\": \"A shared network\",\n"
 "                \"name\": \"foo\",\n"
 "                \"option-data\": [ ],\n"
-"                \"preferred-lifetime\": 0,\n"
+"                \"preferred-lifetime\": 3600,\n"
 "                \"rapid-commit\": false,\n"
+"                \"rebind-timer\": 1800,\n"
 "                \"relay\": {\n"
 "                    \"ip-addresses\": [ ]\n"
 "                },\n"
+"                \"renew-timer\": 900,\n"
 "                \"reservation-mode\": \"all\",\n"
 "                \"subnet6\": [\n"
 "                    {\n"
@@ -7536,7 +7538,8 @@ const char* UNPARSED_CONFIGS[] = {
 "                        \"subnet\": \"2001:db1::/48\",\n"
 "                        \"valid-lifetime\": 7200\n"
 "                    }\n"
-"                ]\n"
+"                ],\n"
+"                \"valid-lifetime\": 7200\n"
 "            }\n"
 "        ],\n"
 "        \"subnet6\": [ ]\n"
index af2e1262f1a0e8a7a89a0e98dec042e4b6d138c4..ae57abdcefb5b31bcc8581bf58c2871722933c57 100644 (file)
@@ -230,9 +230,11 @@ Network6::toElement() const {
     ElementPtr map = Network::toElement();
 
     // Set preferred-lifetime
-    map->set("preferred-lifetime",
-             Element::create(static_cast<long long>
-                             (getPreferred().get())));
+    if (!getPreferred().unspecified()) {
+        map->set("preferred-lifetime",
+                 Element::create(static_cast<long long>
+                                 (getPreferred().get())));
+    }
 
     // Set interface-id
     const OptionPtr& ifaceid = getInterfaceId();
index d71670c1d88163a244cee051e84f557baf2202b7..1e9a01eda37f1ed412360c6661a1ab51b1cc97c0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2019 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
@@ -129,7 +129,6 @@ TEST(CfgSharedNetworks6Test, unparse) {
         "    \"interface\": \"eth1\",\n"
         "    \"name\": \"dog\",\n"
         "    \"option-data\": [ ],\n"
-        "    \"preferred-lifetime\": 0,\n"
         "    \"rapid-commit\": false,\n"
         "    \"rebind-timer\": 200,\n"
         "    \"relay\": { \"ip-addresses\": [ ] },\n"
@@ -142,7 +141,6 @@ TEST(CfgSharedNetworks6Test, unparse) {
         "    \"interface\": \"eth0\",\n"
         "    \"name\": \"frog\",\n"
         "    \"option-data\": [ ],\n"
-        "    \"preferred-lifetime\": 0,\n"
         "    \"rapid-commit\": false,\n"
         "    \"relay\": { \"ip-addresses\": [ \"2001:db8:1::1\", \"2001:db8:1::2\" ] },\n"
         "    \"reservation-mode\": \"all\","