Browse Source

[master] Unit-test fix after #3981 merge.

 - Statistic is now reset properly in DeclineTest.*
Tomek Mrugalski 9 years ago
parent
commit
171de0b827
2 changed files with 11 additions and 11 deletions
  1. 10 10
      src/bin/dhcp4/tests/decline_unittest.cc
  2. 1 1
      src/lib/dhcpsrv/tests/lease_unittest.cc

+ 10 - 10
src/bin/dhcp4/tests/decline_unittest.cc

@@ -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);

+ 1 - 1
src/lib/dhcpsrv/tests/lease_unittest.cc

@@ -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)
 }