From: Marcin Siodelski Date: Tue, 28 Mar 2023 07:01:08 +0000 (+0200) Subject: [#2780] Fixed unstable unit tests X-Git-Tag: Kea-2.3.7~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cae3447b6c6b903f458dd4229ea8bc51e9b03ffb;p=thirdparty%2Fkea.git [#2780] Fixed unstable unit tests --- diff --git a/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc b/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc index 86a17c1470..15c021b59a 100644 --- a/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc +++ b/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc @@ -177,7 +177,8 @@ TEST_F(FreeLeaseQueueAllocatorTest4, singlePoolWithReclamations) { IOAddress candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0")); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate, cc_)); - auto lease = createLease4(candidate, i); + auto lease = lease_mgr.getLease4(candidate); + lease->state_ = Lease::STATE_DEFAULT; EXPECT_NO_THROW(lease_mgr.updateLease4(lease)); } @@ -496,7 +497,8 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePoolWithReclamations) { IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate, cc_)); - auto lease = createLease6(Lease::TYPE_NA, candidate, i); + auto lease = lease_mgr.getLease6(Lease::TYPE_NA, candidate); + lease->state_ = Lease::STATE_DEFAULT; EXPECT_NO_THROW(lease_mgr.updateLease6(lease)); } @@ -810,7 +812,8 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePdPoolWithReclamations) { candidate = alloc.pickPrefix(cc_, pool, duid_, Allocator::PREFIX_LEN_HIGHER, IOAddress("::"), 0); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate, cc_)); - auto lease = createLease6(Lease::TYPE_PD, candidate, i); + auto lease = lease_mgr.getLease6(Lease::TYPE_PD, candidate); + lease->state_ = Lease::STATE_DEFAULT; EXPECT_NO_THROW(lease_mgr.updateLease6(lease)); }