]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[168-config-manager-clear-does-not-clear-the-d2-client-config-full-clear] Fixed unit... 168-config-manager-clear-does-not-clear-the-d2-client-config-full-clear
authorFrancis Dupont <fdupont@isc.org>
Wed, 18 Sep 2019 13:52:03 +0000 (15:52 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 20 Sep 2019 06:44:56 +0000 (02:44 -0400)
src/bin/dhcp4/tests/d2_unittest.cc
src/bin/dhcp6/tests/d2_unittest.cc
src/bin/dhcp6/tests/fqdn_unittest.cc

index f5ebbdb9da82e21ce6c9ecc5889010dc378242b0..bb906f6c6c7cb1abff6e30c55009fe38b33a5f93 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-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
@@ -68,6 +68,8 @@ Dhcp4SrvD2Test::buildTestNcr(uint32_t dhcid_id_num) {
 
 void
 Dhcp4SrvD2Test::reset() {
+    CfgMgr::instance().clear();
+
     std::string config = "{ \"interfaces-config\": {"
             "    \"interfaces\": [ \"*\" ]"
             "},"
@@ -123,8 +125,6 @@ Dhcp4SrvD2Test::configure(const std::string& config, bool exp_result) {
     ElementPtr json = Element::fromJSON(config);
     ConstElementPtr status;
 
-    CfgMgr::instance().clear();
-
     // Configure the server and make sure the config is accepted
     EXPECT_NO_THROW(status = configureDhcp4Server(srv_, json));
     ASSERT_TRUE(status);
@@ -136,6 +136,10 @@ Dhcp4SrvD2Test::configure(const std::string& config, bool exp_result) {
     } else {
         ASSERT_EQ(1, rcode);
     }
+
+    if (rcode == 0) {
+        CfgMgr::instance().commit();
+    }
 }
 
 // Tests ability to turn on and off ddns updates by submitting
index 79b1d94846b8ecada04cd09fbb1a56e0d50e84cf..68875f9f2e797e794019f96ac6add1b2f334fa1c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-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
@@ -70,6 +70,8 @@ Dhcp6SrvD2Test::buildTestNcr(uint32_t dhcid_id_num) {
 
 void
 Dhcp6SrvD2Test::reset() {
+    CfgMgr::instance().clear();
+
     std::string config = "{ \"interfaces-config\": {"
             "  \"interfaces\": [ \"*\" ]"
             "},"
@@ -125,7 +127,6 @@ Dhcp6SrvD2Test::configureD2(bool enable_d2, const bool exp_result,
 
 void
 Dhcp6SrvD2Test::configure(const std::string& config, bool exp_result) {
-    CfgMgr::instance().clear();
     ElementPtr json = Element::fromJSON(config);
     ConstElementPtr status;
 
@@ -140,6 +141,10 @@ Dhcp6SrvD2Test::configure(const std::string& config, bool exp_result) {
     } else {
         ASSERT_EQ(1, rcode);
     }
+
+    if (rcode == 0) {
+        CfgMgr::instance().commit();
+    }
 }
 
 // Tests ability to turn on and off ddns updates by submitting
index cb34d62dddc6cc5efe0cce61ce04c52f28d4a31f..a6ec3efb02e7fb78ee7b36977e8140eb7a9d921f 100644 (file)
@@ -1277,6 +1277,9 @@ TEST_F(FqdnDhcpv6SrvTest, processRequestReuseExpiredLease) {
     CfgMgr::instance().getStagingCfg()->getCfgSubnets6()->add(subnet_);
     CfgMgr::instance().commit();
 
+    // Enable D2.
+    enableD2();
+
     // Allocate a lease.
     testProcessMessage(DHCPV6_REQUEST, "myhost.example.com",
                        "myhost.example.com.");