2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 18:08:16 +00:00

[#1958] fixed unrelated compilation warning

This commit is contained in:
Razvan Becheriu 2023-01-17 19:32:08 +02:00
parent b6f0aaa01e
commit a57caf1de3
2 changed files with 24 additions and 19 deletions

View File

@ -18,7 +18,8 @@ namespace isc {
namespace dhcp {
namespace test {
template<typename PacketQueuePtrType> void checkInfo(PacketQueuePtrType queue, const std::string& exp_json) {
template<typename PacketQueuePtrType>
void checkInfo(PacketQueuePtrType queue, const std::string& exp_json) {
ASSERT_TRUE(queue) << "packet queue ptr is null";
// Fetch the queue info and verify it has all the expected values.
data::ElementPtr info;
@ -38,8 +39,8 @@ template<typename PacketQueuePtrType> void checkInfo(PacketQueuePtrType queue, c
}
template<typename PacketQueuePtrType> void checkIntStat(PacketQueuePtrType queue,
const std::string& name, size_t exp_value) {
template<typename PacketQueuePtrType>
void checkIntStat(PacketQueuePtrType queue, const std::string& name, size_t exp_value) {
ASSERT_TRUE(queue) << "packet queue ptr is null";
data::ElementPtr info;
ASSERT_NO_THROW(info = queue->getInfo());
@ -49,15 +50,15 @@ template<typename PacketQueuePtrType> void checkIntStat(PacketQueuePtrType queue
ASSERT_NO_THROW(elem = info->get(name)) << "stat: " << name << " not in info" << std::endl;
ASSERT_TRUE(elem);
int64_t value;
int64_t value = 0;
ASSERT_NO_THROW(value = elem->intValue());
EXPECT_EQ(exp_value, value) << "stat: " << name << " is wrong" << std::endl;;
}
extern data::ElementPtr makeQueueConfig(const std::string& queue_type, size_t capacity, bool enable_queue=true);
}; // end of namespace isc::dhcp::test
}; // end of namespace isc::dhcp
}; // end of namespace isc
} // namespace test
} // namespace dhcp
} // namespace isc
#endif // PACKET_QUEUE_TESTUTILS_H

View File

@ -2130,6 +2130,7 @@ TEST_F(AllocEngine6Test, largePdPoolPreferrSmaller) {
subnet_->addPool(pool2);
// We should have got exactly one lease.
// Even though the hint is from the first pool, the second pool is preferred.
Lease6Collection leases = allocateTest(engine, pool2, IOAddress("2001:db8:1:2::"),
false, true, 92);
ASSERT_EQ(1, leases.size());
@ -2153,14 +2154,14 @@ TEST_F(AllocEngine6Test, largePdPoolPreferrExistingLeaseInsteadOfSmaller) {
subnet_->addPool(pool2);
// Let's create a lease and put it in the LeaseMgr
// Even if the the prefix length in the hint does not match, the allocation
// Even if the prefix length in the hint does not match, the allocation
// engine should use the existing lease.
Lease6Ptr used(new Lease6(Lease::TYPE_PD, IOAddress("2001:db8:1:2::"),
duid_, iaid_, 501, 502, subnet_->getID(), HWAddrPtr(), 96));
duid_, iaid_, 300, 400, subnet_->getID(), HWAddrPtr(), 96));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// We should have got exactly one lease.
Lease6Collection leases = allocateTest(engine, pool, IOAddress("2001:db8:1:2::"),
Lease6Collection leases = allocateTest(engine, pool, IOAddress("2001:db8:1:3::"),
false, true, 92);
ASSERT_EQ(1, leases.size());
}
@ -2182,6 +2183,7 @@ TEST_F(AllocEngine6Test, largePdPoolPreferrEqual) {
subnet_->addPool(pool2);
// We should have got exactly one lease.
// Even though the hint is from the first pool, the second pool is preferred.
Lease6Collection leases = allocateTest(engine, pool2, IOAddress("2001:db8:1:2::"),
false, true, 80);
ASSERT_EQ(1, leases.size());
@ -2205,14 +2207,14 @@ TEST_F(AllocEngine6Test, largePdPoolPreferrExistingLeaseInsteadOfEqual) {
subnet_->addPool(pool2);
// Let's create a lease and put it in the LeaseMgr
// Even if the the prefix length in the hint does not match, the allocation
// Even if the prefix length in the hint does not match, the allocation
// engine should use the existing lease.
Lease6Ptr used(new Lease6(Lease::TYPE_PD, IOAddress("2001:db8:1:2::"),
duid_, iaid_, 501, 502, subnet_->getID(), HWAddrPtr(), 96));
duid_, iaid_, 300, 400, subnet_->getID(), HWAddrPtr(), 96));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// We should have got exactly one lease.
Lease6Collection leases = allocateTest(engine, pool, IOAddress("2001:db8:1:2::"),
Lease6Collection leases = allocateTest(engine, pool, IOAddress("2001:db8:1:3::"),
false, true, 80);
ASSERT_EQ(1, leases.size());
}
@ -2234,7 +2236,9 @@ TEST_F(AllocEngine6Test, largePdPoolPreferrGreater) {
subnet_->addPool(pool2);
// We should have got exactly one lease.
Lease6Collection leases = allocateTest(engine, pool, IOAddress("2001:db8:1:3::"),
// Even though the first pool also matches the condition, because of the hint,
// the second pool is preferred.
Lease6Collection leases = allocateTest(engine, pool2, IOAddress("2001:db8:1:3::"),
false, true, 64);
ASSERT_EQ(1, leases.size());
}
@ -2257,14 +2261,14 @@ TEST_F(AllocEngine6Test, largePdPoolPreferrExistingLeaseInsteadOfGreater) {
subnet_->addPool(pool2);
// Let's create a lease and put it in the LeaseMgr
// Even if the lease is owned by the client, the non-matching prefix length
// in the hint should force allocation of other lease.
Lease6Ptr used(new Lease6(Lease::TYPE_PD, IOAddress("2001:db8:1:3::"),
duid_, iaid_, 5001, 502, subnet_->getID(), HWAddrPtr(), 80));
// Even if the prefix length in the hint does not match, the allocation
// engine should use the existing lease.
Lease6Ptr used(new Lease6(Lease::TYPE_PD, IOAddress("2001:db8:1:2::"),
duid_, iaid_, 300, 400, subnet_->getID(), HWAddrPtr(), 96));
ASSERT_TRUE(LeaseMgrFactory::instance().addLease(used));
// We should have got exactly one lease.
Lease6Collection leases = allocateTest(engine, pool2, IOAddress("2001:db8:1:3::"),
Lease6Collection leases = allocateTest(engine, pool, IOAddress("2001:db8:1:3::"),
false, true, 64);
ASSERT_EQ(1, leases.size());
}