From 7cf5a90e8f8181c185fa80fa1fd9782ba3dd879b Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 7 Oct 2024 14:20:01 +0200 Subject: [PATCH] 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. --- pdns/recursordist/recursor_cache.cc | 2 ++ pdns/recursordist/test-reczones-helpers.cc | 2 +- pdns/recursordist/test-syncres_cc.cc | 4 +--- 3 files changed, 4 insertions(+), 4 deletions(-) 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(); -- 2.47.2