From: Tomek Mrugalski Date: Fri, 18 Sep 2015 17:04:26 +0000 (+0200) Subject: [master] Unit-test fix after #3981 merge. X-Git-Tag: trac4061_base~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=171de0b827654e4d09e234c5ec6aa4be8e026695;p=thirdparty%2Fkea.git [master] Unit-test fix after #3981 merge. - Statistic is now reset properly in DeclineTest.* --- diff --git a/src/bin/dhcp4/tests/decline_unittest.cc b/src/bin/dhcp4/tests/decline_unittest.cc index 2252c3141e..db1f72554e 100644 --- a/src/bin/dhcp4/tests/decline_unittest.cc +++ b/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(0)); - // Set this global statistic explicitly to zero. isc::stats::StatsMgr::instance().setValue("declined-addresses", static_cast(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(0)); + // Check the declined-addresses (subnet) statistic before the Decline operation. ObservationPtr declined_cnt = StatsMgr::instance().getObservation(name.str()); ASSERT_TRUE(declined_cnt); diff --git a/src/lib/dhcpsrv/tests/lease_unittest.cc b/src/lib/dhcpsrv/tests/lease_unittest.cc index eb583fdc89..7b22f99a12 100644 --- a/src/lib/dhcpsrv/tests/lease_unittest.cc +++ b/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) }