2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 05:27:55 +00:00

[#2588] Updated code and unit tests

This commit is contained in:
Francis Dupont 2022-10-11 16:14:48 +02:00
parent 999e35e30c
commit ead7df0ea6
2 changed files with 12 additions and 3 deletions

View File

@ -3147,6 +3147,7 @@ void AllocEngine::reclaimLeaseInDatabase(const LeasePtrType& lease,
lease->fqdn_fwd_ = false;
lease->fqdn_rev_ = false;
lease->state_ = Lease::STATE_EXPIRED_RECLAIMED;
lease->setContext(ElementPtr());
lease_update_fun(lease);
} else {

View File

@ -1,4 +1,4 @@
// Copyright (C) 2015-2020 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2022 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@ -24,6 +24,7 @@
using namespace std;
using namespace isc;
using namespace isc::asiolink;
using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::dhcp::test;
using namespace isc::dhcp_ddns;
@ -426,7 +427,7 @@ public:
static bool leaseReclaimed(const LeasePtrType& lease) {
return (lease && lease->stateExpiredReclaimed() &&
lease->hostname_.empty() && !lease->fqdn_fwd_ &&
!lease->fqdn_rev_);
!lease->fqdn_rev_ && !lease->getContext());
}
/// @brief Lease algorithm checking if lease state is Declined.
@ -1279,7 +1280,11 @@ ExpirationAllocEngine6Test::createLeases() {
Lease6Ptr lease(new Lease6(Lease::TYPE_NA, address, duid, 1, 50, 60,
SubnetID(1), true, true,
generateHostnameForLeaseIndex(i)));
ElementPtr user_context = Element::createMap();
user_context->set("index", Element::create(static_cast<int>(i)));
lease->setContext(user_context);
leases_.push_back(lease);
// Copy the lease before adding it to the lease manager. We want to
// make sure that modifications to the leases held in the leases_
// container doesn't affect the leases in the lease manager.
@ -1841,6 +1846,9 @@ ExpirationAllocEngine4Test::createLeases() {
Lease4Ptr lease(new Lease4(address, hwaddr, ClientIdPtr(), 60,
time(NULL), SubnetID(1), true, true,
generateHostnameForLeaseIndex(i)));
ElementPtr user_context = Element::createMap();
user_context->set("index", Element::create(static_cast<int>(i)));
lease->setContext(user_context);
leases_.push_back(lease);
// Copy the lease before adding it to the lease manager. We want to
// make sure that modifications to the leases held in the leases_
@ -2320,4 +2328,4 @@ TEST_F(ExpirationAllocEngine4Test, reclaimDeclinedHook2) {
testReclaimDeclinedHook(true); // true = use skip callout
}
}; // end of anonymous namespace
} // end of anonymous namespace