From: Otto Moerbeek Date: Mon, 7 Oct 2024 12:20:01 +0000 (+0200) Subject: rec: make sure the record cache has sane parameters for each unit test X-Git-Tag: rec-5.2.0-alpha1~38^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F14754%2Fhead;p=thirdparty%2Fpdns.git rec: make sure the record cache has sane parameters for each unit test In particluar if a specific test was run that would set the maximum RRSET very low, the reczones_helpers/test_UserHints test would fail. --- diff --git a/pdns/recursordist/recursor_cache.cc b/pdns/recursordist/recursor_cache.cc index 7071b800ac..28f8e2261e 100644 --- a/pdns/recursordist/recursor_cache.cc +++ b/pdns/recursordist/recursor_cache.cc @@ -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) : diff --git a/pdns/recursordist/test-reczones-helpers.cc b/pdns/recursordist/test-reczones-helpers.cc index a010c13fea..7b0d4845ac 100644 --- a/pdns/recursordist/test-reczones-helpers.cc +++ b/pdns/recursordist/test-reczones-helpers.cc @@ -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(); ::arg().set("max-generate-steps") = "0"; diff --git a/pdns/recursordist/test-syncres_cc.cc b/pdns/recursordist/test-syncres_cc.cc index 96aa8e164a..94d3ff6e43 100644 --- a/pdns/recursordist/test-syncres_cc.cc +++ b/pdns/recursordist/test-syncres_cc.cc @@ -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(); g_negCache = std::make_unique();