]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Make sure the TTD is expired in the cache cleaning unit tests
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 3 Mar 2021 08:31:44 +0000 (09:31 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 3 Mar 2021 08:31:44 +0000 (09:31 +0100)
We were using a too small time margin in the test, causing some issues
to not be expired when the test takes more than one second to insert
the cache entries.
Use a one-hour margin instead.

pdns/test-dnsdistpacketcache_cc.cc

index 844179a60af2e3ddd28922f05b96cca34186e3f1..c39a304d1133191118e49a5b7dd20ad798c8e4d0 100644 (file)
@@ -201,12 +201,12 @@ BOOST_AUTO_TEST_CASE(test_PacketCacheSharded) {
     BOOST_CHECK_EQUAL(expired, 0U);
 
     /* but after the TTL .. let's ask for at most 1k entries */
-    auto removed = PC.purgeExpired(1000, now + 7200 + 1);
+    auto removed = PC.purgeExpired(1000, now + 7200 + 3600);
     BOOST_CHECK_EQUAL(removed, remaining - 1000U);
     BOOST_CHECK_EQUAL(PC.getSize(), 1000U);
 
     /* now remove everything */
-    removed = PC.purgeExpired(0, now + 7200 + 1);
+    removed = PC.purgeExpired(0, now + 7200 + 3600);
     BOOST_CHECK_EQUAL(removed, 1000U);
     BOOST_CHECK_EQUAL(PC.getSize(), 0U);
   }