BIND 10 trac2940, updated. ad2132e568f5db4b7926d2bf56214d195061cce1 [2940] Extend null client id unit test.
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Nov 14 15:13:32 UTC 2013
The branch, trac2940 has been updated
via ad2132e568f5db4b7926d2bf56214d195061cce1 (commit)
from 54910e664a3697b1b486b84d08aba0c382a5ecc7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ad2132e568f5db4b7926d2bf56214d195061cce1
Author: Marcin Siodelski <marcin at isc.org>
Date: Thu Nov 14 16:05:07 2013 +0100
[2940] Extend null client id unit test.
-----------------------------------------------------------------------
Summary of changes:
.../dhcpsrv/tests/memfile_lease_mgr_unittest.cc | 25 ++++++++++++++++----
1 file changed, 20 insertions(+), 5 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
index cd9a222..227c6e3 100644
--- a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
@@ -222,19 +222,34 @@ TEST_F(MemfileLeaseMgrTest, getLease4ClientIdHWAddrSubnetId) {
Lease4Ptr leaseA = initializeLease4(straddress4_[4]);
Lease4Ptr leaseB = initializeLease4(straddress4_[5]);
+ Lease4Ptr leaseC = initializeLease4(straddress4_[6]);
+ // Set NULL client id for one of the leases. This is to make sure that such
+ // a lease may coexist with other leases with non NULL client id.
+ leaseC->client_id_.reset();
+
HWAddr hwaddrA(leaseA->hwaddr_, HTYPE_ETHER);
HWAddr hwaddrB(leaseB->hwaddr_, HTYPE_ETHER);
+ HWAddr hwaddrC(leaseC->hwaddr_, HTYPE_ETHER);
EXPECT_TRUE(lease_mgr->addLease(leaseA));
+ EXPECT_TRUE(lease_mgr->addLease(leaseB));
+ EXPECT_TRUE(lease_mgr->addLease(leaseC));
// First case we should retrieve our lease
Lease4Ptr lease = lease_mgr->getLease4(*leaseA->client_id_, hwaddrA, leaseA->subnet_id_);
detailCompareLease(lease, leaseA);
- lease = lease_mgr->getLease4(*leaseB->client_id_, hwaddrA, leaseA->subnet_id_);
- detailCompareLease(lease, leaseA);
- // But not the folowing, with different hwaddr and subnet
+ // Retrieve the other lease.
+ lease = lease_mgr->getLease4(*leaseB->client_id_, hwaddrB, leaseB->subnet_id_);
+ detailCompareLease(lease, leaseB);
+ // The last lease has NULL client id so we will use a different getLease4 function
+ // which doesn't require client id (just a hwaddr and subnet id).
+ lease = lease_mgr->getLease4(hwaddrC, leaseC->subnet_id_);
+ detailCompareLease(lease, leaseC);
+
+ // An attempt to retrieve the lease with non matching lease parameters should
+ // result in NULL pointer being returned.
lease = lease_mgr->getLease4(*leaseA->client_id_, hwaddrB, leaseA->subnet_id_);
- EXPECT_TRUE(lease == Lease4Ptr());
+ EXPECT_FALSE(lease);
lease = lease_mgr->getLease4(*leaseA->client_id_, hwaddrA, leaseB->subnet_id_);
- EXPECT_TRUE(lease == Lease4Ptr());
+ EXPECT_FALSE(lease);
}
}; // end of anonymous namespace
More information about the bind10-changes
mailing list