]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: make sure the record cache has sane parameters for each unit test 14754/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 7 Oct 2024 12:20:01 +0000 (14:20 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 7 Oct 2024 13:07:36 +0000 (15:07 +0200)
In particluar if a specific test was run that would set the maximum
RRSET very low, the reczones_helpers/test_UserHints test would fail.

pdns/recursordist/recursor_cache.cc
pdns/recursordist/test-reczones-helpers.cc
pdns/recursordist/test-syncres_cc.cc

index 7071b800acd0ecd4d536e2459c885a4cdaf69d77..28f8e2261e0ff8942994a410d03cb3a7ac876b5d 100644 (file)
@@ -61,6 +61,8 @@ void MemRecursorCache::resetStaticsForTests()
   SyncRes::s_refresh_ttlperc = 0;
   SyncRes::s_locked_ttlperc = 0;
   SyncRes::s_minimumTTL = 0;
+  s_maxRRSetSize = 256;
+  s_limitQTypeAny = true;
 }
 
 MemRecursorCache::MemRecursorCache(size_t mapsCount) :
index a010c13fea317f0d0758bbafe7d304f8f3dc2274..7b0d4845acebdb07c0b9ca806651678a41d8b21c 100644 (file)
@@ -272,7 +272,7 @@ const std::string hints = ". 3600 IN NS ns.\n"
 
 BOOST_AUTO_TEST_CASE(test_UserHints)
 {
-
+  MemRecursorCache::resetStaticsForTests();
   g_recCache = make_unique<MemRecursorCache>();
 
   ::arg().set("max-generate-steps") = "0";
index 96aa8e164a94855c73ea88e0b7ab78fb739c80e0..94d3ff6e435607eaea5c0e5034a362f58b1bd3c8 100644 (file)
@@ -142,9 +142,7 @@ void initSR(bool debug)
   }
 
   RecursorPacketCache::s_refresh_ttlperc = 0;
-  MemRecursorCache::s_maxServedStaleExtensions = 0;
-  MemRecursorCache::s_maxRRSetSize = 100;
-  MemRecursorCache::s_limitQTypeAny = true;
+  MemRecursorCache::resetStaticsForTests();
   NegCache::s_maxServedStaleExtensions = 0;
   g_recCache = std::make_unique<MemRecursorCache>();
   g_negCache = std::make_unique<NegCache>();