BIND 10 trac2592, updated. 96ad742151cbbf6a21da7827f395a9365c18585d [2592] ChangeLog updated.
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Aug 22 11:54:29 UTC 2013
The branch, trac2592 has been updated
via 96ad742151cbbf6a21da7827f395a9365c18585d (commit)
via a3cb27a3800156227c362565a5778c1f3f9a9557 (commit)
from 09b659275c05d9bb215148b5c4976eed50ba4cba (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 96ad742151cbbf6a21da7827f395a9365c18585d
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Thu Aug 22 13:54:18 2013 +0200
[2592] ChangeLog updated.
commit a3cb27a3800156227c362565a5778c1f3f9a9557
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Thu Aug 22 13:51:34 2013 +0200
[2592] Memfile unit-tests added by David Carlier
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 4 +-
.../dhcpsrv/tests/memfile_lease_mgr_unittest.cc | 54 +++++++++++++++++++-
2 files changed, 55 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index b3152a6..971213e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
-6XX. [func] dclink
+6XX. [func] dclink,tomek
memfile backend now supports getLease4(hwaddr) and getLease4(client-id)
- methods.
+ methods. Thanks to David Carlier for contributing a patch.
(Trac #2592, git ABCD)
658. [func]* vorner
diff --git a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
index 258622e..cf36d2c 100644
--- a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
@@ -131,6 +131,58 @@ TEST_F(MemfileLeaseMgrTest, addGetDelete6) {
EXPECT_EQ(Lease6Ptr(), x);
}
-// TODO: Write more memfile tests
+// @todo Write more memfile tests
+
+// Simple test about lease4 retrieval through client id method
+TEST_F(MemfileLeaseMgrTest, getLease4ClientId) {
+ const LeaseMgr::ParameterMap pmap;
+ boost::scoped_ptr<Memfile_LeaseMgr> lease_mgr(new Memfile_LeaseMgr(pmap));
+ // Let's initialize a specific lease ...
+ Lease4Ptr lease = initializeLease4(straddress4_[1]);
+ EXPECT_TRUE(lease_mgr->addLease(lease));
+ Lease4Collection returned = lease_mgr->getLease4(*lease->client_id_);
+
+ ASSERT_EQ(1, returned.size());
+ // We should retrieve our lease...
+ detailCompareLease(lease, *returned.begin());
+}
+
+// Checks that lease4 retrieval client id is null is working
+TEST_F(MemfileLeaseMgrTest, getLease4NullClientId) {
+ const LeaseMgr::ParameterMap pmap;
+ boost::scoped_ptr<Memfile_LeaseMgr> lease_mgr(new Memfile_LeaseMgr(pmap));
+ // Let's initialize a specific lease ... But this time
+ // We keep its client id for further lookup and
+ // We clearly 'reset' it ...
+ Lease4Ptr lease = initializeLease4(straddress4_[4]);
+ ClientIdPtr client_id = lease->client_id_;
+ lease->client_id_ = ClientIdPtr();
+ EXPECT_TRUE(lease_mgr->addLease(lease));
+
+ Lease4Collection returned = lease_mgr->getLease4(*client_id);
+ // Shouldn't have our previous lease ...
+ ASSERT_EQ(0, returned.size());
+}
+
+// Checks lease4 retrieval through HWAddr
+TEST_F(MemfileLeaseMgrTest, getLease4HWAddr) {
+ const LeaseMgr::ParameterMap pmap;
+ boost::scoped_ptr<Memfile_LeaseMgr> lease_mgr(new Memfile_LeaseMgr(pmap));
+ // Let's initialize two different leases 4 and just add the first ...
+ Lease4Ptr leaseA = initializeLease4(straddress4_[5]);
+ Lease4Ptr leaseB = initializeLease4(straddress4_[6]);
+ HWAddr hwaddrA(leaseA->hwaddr_, HTYPE_ETHER);
+ HWAddr hwaddrB(leaseB->hwaddr_, HTYPE_ETHER);
+
+ EXPECT_TRUE(lease_mgr->addLease(leaseA));
+
+ // we should not have a lease, with this MAC Addr
+ Lease4Collection returned = lease_mgr->getLease4(hwaddrB);
+ ASSERT_EQ(0, returned.size());
+
+ // But with this one
+ returned = lease_mgr->getLease4(hwaddrA);
+ ASSERT_EQ(1, returned.size());
+}
}; // end of anonymous namespace
More information about the bind10-changes
mailing list