]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Unit-test fix after #3981 merge.
authorTomek Mrugalski <tomasz@isc.org>
Fri, 18 Sep 2015 17:04:26 +0000 (19:04 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 18 Sep 2015 17:04:26 +0000 (19:04 +0200)
 - Statistic is now reset properly in DeclineTest.*

src/bin/dhcp4/tests/decline_unittest.cc
src/lib/dhcpsrv/tests/lease_unittest.cc

index 2252c3141ee681bfce0aa1b30ec68aab91513a2f..db1f72554e93add34c1071c2cef466d06b4f7e64 100644 (file)
@@ -138,16 +138,6 @@ DeclineTest::acquireAndDecline(const std::string& hw_address_1,
                                const std::string& client_id_2,
                                ExpectedResult expected_result) {
 
-    // Let's get the subnet-id and generate statistics name out of it.
-    const Subnet4Collection* subnets =
-        CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll();
-    ASSERT_EQ(1, subnets->size());
-    std::stringstream name;
-    name << "subnet[" << subnets->at(0)->getID() << "].declined-addresses";
-
-    // Set the subnet specific statistic explicitly to zero.
-    isc::stats::StatsMgr::instance().setValue(name.str(), static_cast<int64_t>(0));
-
     // Set this global statistic explicitly to zero.
     isc::stats::StatsMgr::instance().setValue("declined-addresses",
                                               static_cast<int64_t>(0));
@@ -164,6 +154,16 @@ DeclineTest::acquireAndDecline(const std::string& hw_address_1,
     // Perform 4-way exchange to obtain a new lease.
     acquireLease(client);
 
+    // Let's get the subnet-id and generate statistics name out of it.
+    const Subnet4Collection* subnets =
+        CfgMgr::instance().getCurrentCfg()->getCfgSubnets4()->getAll();
+    ASSERT_EQ(1, subnets->size());
+    std::stringstream name;
+    name << "subnet[" << subnets->at(0)->getID() << "].declined-addresses";
+
+    // Set the subnet specific statistic explicitly to zero.
+    isc::stats::StatsMgr::instance().setValue(name.str(), static_cast<int64_t>(0));
+
     // Check the declined-addresses (subnet) statistic before the Decline operation.
     ObservationPtr declined_cnt = StatsMgr::instance().getObservation(name.str());
     ASSERT_TRUE(declined_cnt);
index eb583fdc89ea2fdb90fb16d097aa151c845e4bc6..7b22f99a12c905a65e1ba8a4ce40e917bba7b471 100644 (file)
@@ -771,7 +771,7 @@ TEST(Lease6Test, getDuidVector) {
 }
 
 // Verify that decline() method properly clears up specific fields.
-TEST_F(Lease6Test, decline) {
+TEST(Lease6Test, decline) {
     /// @todo (see ticket 3981)
 }