From 09bbe3a63e31e89eae587335e60efd189c40f6f0 Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Mon, 6 Nov 2023 09:46:11 +0000 Subject: Make test for target numdocs auto-tuning aware of sanitizers Test must mirror the logic used for enabling auto-tuning, or it will fail when testing on a sanitizer-instrumented build. --- .../proton_config_fetcher/proton_config_fetcher_test.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'searchcore') diff --git a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp index 7f24dd6f30f..09cec0d6d01 100644 --- a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp +++ b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -393,6 +394,15 @@ TEST_FF("require that target numdocs is fixed 1k for indexed mode", } } +constexpr bool target_numdocs_hw_adjustment_is_enabled() noexcept { + // Must mirror logic of `use_hw_memory_presized_target_num_docs()` in documentdbconfigmanager.cpp +#ifndef VESPA_USE_SANITIZER + return true; +#else + return false; +#endif +} + TEST_FF("require that target numdocs follows memory for streaming mode", ConfigTestFixture("search"), DocumentDBConfigManager(f1.configId + "/test", "test")) @@ -401,12 +411,14 @@ TEST_FF("require that target numdocs follows memory for streaming mode", { auto config = getDocumentDBConfig(f1, f2, createHwInfoWithMemory(1_Gi)); AllocStrategy strategy = config->get_alloc_config().make_alloc_strategy(SubDbType::READY); - EXPECT_EQUAL(23342213u, strategy.get_grow_strategy().getMinimumCapacity()); + const auto expected = target_numdocs_hw_adjustment_is_enabled() ? 23342213u : 1024u; + EXPECT_EQUAL(expected, strategy.get_grow_strategy().getMinimumCapacity()); } { auto config = getDocumentDBConfig(f1, f2, createHwInfoWithMemory(10_Gi)); AllocStrategy strategy = config->get_alloc_config().make_alloc_strategy(SubDbType::READY); - EXPECT_EQUAL(233422135u, strategy.get_grow_strategy().getMinimumCapacity()); + const auto expected = target_numdocs_hw_adjustment_is_enabled() ? 233422135u : 1024u; + EXPECT_EQUAL(expected, strategy.get_grow_strategy().getMinimumCapacity()); } } -- cgit v1.2.3