]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: try simple packet cache test with shuffle
authorKarel Bilek <kb@karelbilek.com>
Tue, 11 Nov 2025 15:35:33 +0000 (16:35 +0100)
committerKarel Bilek <kb@karelbilek.com>
Tue, 11 Nov 2025 15:47:15 +0000 (16:47 +0100)
Signed-off-by: Karel Bilek <kb@karelbilek.com>
pdns/dnsdistdist/test-dnsdistpacketcache_cc.cc

index d275f8b4bb5fcdb264fd9e40782ab95227742f14..cb0cb3a17c60cb323e0424800fedef4115f179eb 100644 (file)
@@ -20,12 +20,13 @@ BOOST_AUTO_TEST_SUITE(test_dnsdistpacketcache_cc)
 
 static bool receivedOverUDP = true;
 
-BOOST_AUTO_TEST_CASE(test_PacketCacheSimple)
+static void test_packetcache_simple(bool shuffle)
 {
   const DNSDistPacketCache::CacheSettings settings{
     .d_maxEntries = 150000,
     .d_maxTTL = 86400,
     .d_minTTL = 1,
+    .d_shuffle = shuffle,
   };
   DNSDistPacketCache localCache(settings);
   BOOST_CHECK_EQUAL(localCache.getSize(), 0U);
@@ -133,6 +134,13 @@ BOOST_AUTO_TEST_CASE(test_PacketCacheSimple)
   }
 }
 
+BOOST_AUTO_TEST_CASE(test_PacketCacheSimple)
+{
+  /* test both with and without shuffle; should be equivalent */
+  test_packetcache_simple(false);
+  test_packetcache_simple(true);
+}
+
 BOOST_AUTO_TEST_CASE(test_PacketCacheSharded)
 {
   const DNSDistPacketCache::CacheSettings settings{