]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2780] Fixed unstable unit tests
authorMarcin Siodelski <msiodelski@gmail.com>
Tue, 28 Mar 2023 07:01:08 +0000 (09:01 +0200)
committerMarcin Siodelski <msiodelski@gmail.com>
Wed, 29 Mar 2023 12:45:15 +0000 (14:45 +0200)
src/lib/dhcpsrv/tests/flq_allocator_unittest.cc

index 86a17c14702f55a216ac3342f915516e89ea9ca7..15c021b59ae0012e1b0335e54fa4c7ffad653ee9 100644 (file)
@@ -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));
     }