summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2019-09-18 15:52:03 +0200
committerFrancis Dupont <fdupont@isc.org>2019-09-20 08:44:56 +0200
commit258f0c51f024e42b08635b4a808ddaf75bb24958 (patch)
tree3a236b1d3913f15cc4ce1d1ecf2ebbed179df674 /src
parent[168-config-manager-clear-does-not-clear-the-d2-client-config-full-clear] Cha... (diff)
downloadkea-258f0c51f024e42b08635b4a808ddaf75bb24958.tar.xz
kea-258f0c51f024e42b08635b4a808ddaf75bb24958.zip
[168-config-manager-clear-does-not-clear-the-d2-client-config-full-clear] Fixed unit tests using previous CfgMgr clear() behavior
Diffstat (limited to 'src')
-rw-r--r--src/bin/dhcp4/tests/d2_unittest.cc10
-rw-r--r--src/bin/dhcp6/tests/d2_unittest.cc9
-rw-r--r--src/bin/dhcp6/tests/fqdn_unittest.cc3
3 files changed, 17 insertions, 5 deletions
diff --git a/src/bin/dhcp4/tests/d2_unittest.cc b/src/bin/dhcp4/tests/d2_unittest.cc
index f5ebbdb9da..bb906f6c6c 100644
--- a/src/bin/dhcp4/tests/d2_unittest.cc
+++ b/src/bin/dhcp4/tests/d2_unittest.cc
@@ -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
diff --git a/src/bin/dhcp6/tests/d2_unittest.cc b/src/bin/dhcp6/tests/d2_unittest.cc
index 79b1d94846..68875f9f2e 100644
--- a/src/bin/dhcp6/tests/d2_unittest.cc
+++ b/src/bin/dhcp6/tests/d2_unittest.cc
@@ -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
diff --git a/src/bin/dhcp6/tests/fqdn_unittest.cc b/src/bin/dhcp6/tests/fqdn_unittest.cc
index cb34d62ddd..a6ec3efb02 100644
--- a/src/bin/dhcp6/tests/fqdn_unittest.cc
+++ b/src/bin/dhcp6/tests/fqdn_unittest.cc
@@ -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.");