diff options
author | Dan Theisen <djt@isc.org> | 2022-07-06 21:36:08 +0200 |
---|---|---|
committer | Dan Theisen <djt@isc.org> | 2022-07-08 21:18:55 +0200 |
commit | a7260a26c278071628789ab0c75d73ef0059e194 (patch) | |
tree | 8a4c4ea264aa9a74a72344e6ef0ff1cd8f8fd93e /src | |
parent | [#2419] Begin adding stats to track HR assignment conflicts (diff) | |
download | kea-a7260a26c278071628789ab0c75d73ef0059e194.tar.xz kea-a7260a26c278071628789ab0c75d73ef0059e194.zip |
[#2419] Fix statistics (add v4-reservation-conflicts) unit tests for dhcp4
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc | 3 | ||||
-rw-r--r-- | src/bin/dhcp4/tests/shared_network_unittest.cc | 2 | ||||
-rw-r--r-- | src/lib/dhcpsrv/alloc_engine.cc | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 69580a0c25..4f38e126ec 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -648,7 +648,8 @@ TEST_F(CtrlChannelDhcpv4SrvTest, controlChannelStats) { "v4-allocation-fail-shared-network", "v4-allocation-fail-subnet", "v4-allocation-fail-no-pools", - "v4-allocation-fail-classes" + "v4-allocation-fail-classes", + "v4-reservation-conflicts" }; // preparing the schema which check if all statistics are set to zero diff --git a/src/bin/dhcp4/tests/shared_network_unittest.cc b/src/bin/dhcp4/tests/shared_network_unittest.cc index 5fb3b30efc..8e9601f969 100644 --- a/src/bin/dhcp4/tests/shared_network_unittest.cc +++ b/src/bin/dhcp4/tests/shared_network_unittest.cc @@ -1771,7 +1771,7 @@ TEST_F(Dhcpv4SharedNetworkTest, reservationInSharedNetworkTwoClientsSameIdentifi // Ensure stats are being recorded for HR conflicts ObservationPtr subnet_conflicts = StatsMgr::instance().getObservation( - "subnet[100].reservation-conflicts"); + "subnet[10].reservation-conflicts"); ASSERT_TRUE(subnet_conflicts); ASSERT_EQ(1, subnet_conflicts->getInteger().first); ObservationPtr global_conflicts = StatsMgr::instance().getObservation( diff --git a/src/lib/dhcpsrv/alloc_engine.cc b/src/lib/dhcpsrv/alloc_engine.cc index 350cc46758..444c95fca2 100644 --- a/src/lib/dhcpsrv/alloc_engine.cc +++ b/src/lib/dhcpsrv/alloc_engine.cc @@ -3703,7 +3703,7 @@ AllocEngine::discoverLease4(AllocEngine::ClientContext4& ctx) { "(no lease info)"); StatsMgr::instance().addValue(StatsMgr::generateName( "subnet", - new_lease->subnet_id_, + ctx.conflicting_lease_->subnet_id_, "reservation-conflicts"), static_cast<int64_t>(1)); StatsMgr::instance().addValue("v4-reservation-conflicts", |