]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1434] fixed unittests
authorRazvan Becheriu <razvan@isc.org>
Fri, 16 Oct 2020 15:17:43 +0000 (18:17 +0300)
committerRazvan Becheriu <razvan@isc.org>
Thu, 22 Oct 2020 14:45:55 +0000 (17:45 +0300)
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc

index 5227fcebed7e481a6cb6bafdc1188ba29276ec4a..ce419a521240b13cec645e1a314c43337fb41c89 100644 (file)
@@ -704,6 +704,11 @@ Memfile_LeaseMgr::addLeaseInternal(const Lease4Ptr& lease) {
     }
 
     storage4_.insert(lease);
+
+    // Update lease internal information with new values (allows update of the
+    // internal state between the creation of the Lease up to the point of
+    // insertion in the database).
+    lease->updateInternalTimestamp();
     return (true);
 }
 
@@ -735,6 +740,11 @@ Memfile_LeaseMgr::addLeaseInternal(const Lease6Ptr& lease) {
     }
 
     storage6_.insert(lease);
+
+    // Update lease internal information with new values (allows update of the
+    // internal state between the creation of the Lease up to the point of
+    // insertion in the database).
+    lease->updateInternalTimestamp();
     return (true);
 }
 
@@ -1433,6 +1443,9 @@ Memfile_LeaseMgr::updateLease4Internal(const Lease4Ptr& lease) {
         lease_file4_->append(*lease);
     }
 
+    // Update lease internal information with new values.
+    lease->updateInternalTimestamp();
+
     // Use replace() to re-index leases.
     index.replace(lease_it, Lease4Ptr(new Lease4(*lease)));
 }
@@ -1479,6 +1492,9 @@ Memfile_LeaseMgr::updateLease6Internal(const Lease6Ptr& lease) {
         lease_file6_->append(*lease);
     }
 
+    // Update lease internal information with new values.
+    lease->updateInternalTimestamp();
+
     // Use replace() to re-index leases.
     index.replace(lease_it, Lease6Ptr(new Lease6(*lease)));
 }
index 34c316a50fef44f39f4ee2e18fa36089887d0022..be4b7e191e3fed2af7f8c273c551e053360a27f1 100644 (file)
@@ -3610,6 +3610,7 @@ TEST_F(AllocEngine6Test, globalHostReservedAddress) {
     // We verify the "time" change in case the lease returned to us
     // by expectOneLease ever becomes a copy and not what is in the lease mgr.
     --lease->cltt_;
+    --lease->old_cltt_;
     Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
                                                                lease->addr_);
     ASSERT_TRUE(from_mgr);
@@ -3674,6 +3675,7 @@ TEST_F(AllocEngine6Test, globalHostReservedPrefix) {
     // We verify the "time" change in case the lease returned to us
     // by expectOneLease ever becomes a copy and not what is in the lease mgr.
     --lease->cltt_;
+    --lease->old_cltt_;
     Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
                                                                lease->addr_);
     ASSERT_TRUE(from_mgr);