From da8bd30a5b2dfe36fa4bb7d7820bb8fb9244b0d9 Mon Sep 17 00:00:00 2001 From: Karol Nowacki Date: Thu, 2 Oct 2025 15:38:58 +0200 Subject: [PATCH] vector_search: Unify test timeouts The test previously used separate timeouts for requests (5s) and the overall test case (10s). This change unifies both timeouts to 10 seconds. (cherry picked from commit 62deea62a44ee2e70e80e91868e8d3a288067d18) --- test/vector_search/vector_store_client_test.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/vector_search/vector_store_client_test.cc b/test/vector_search/vector_store_client_test.cc index c5a15ddbb1..eeec168866 100644 --- a/test/vector_search/vector_store_client_test.cc +++ b/test/vector_search/vector_store_client_test.cc @@ -88,7 +88,12 @@ auto repeat_until(milliseconds timeout, std::function()> func) -> f co_return true; } -constexpr auto STANDARD_WAIT = std::chrono::seconds(5); +constexpr auto STANDARD_WAIT = std::chrono::seconds(10); + +auto repeat_until(std::function()> func) -> future { + return repeat_until(STANDARD_WAIT, std::move(func)); +} + class abort_source_timeout { abort_source as; @@ -703,7 +708,7 @@ SEASTAR_TEST_CASE(vector_store_client_uri_update_to_empty) { vs.start_background_tasks(); // Wait for initial DNS resolution - BOOST_CHECK(co_await repeat_until(std::chrono::seconds(5), [&]() -> future { + BOOST_CHECK(co_await repeat_until([&]() -> future { co_return count > 0; })); @@ -811,7 +816,7 @@ SEASTAR_TEST_CASE(vector_store_client_multiple_ips_high_availability) { // Because requests are distributed in random order due to load balancing, // repeat the ANN query until the unavailable server is queried. - BOOST_CHECK(co_await repeat_until(std::chrono::seconds(10), [&]() -> future { + BOOST_CHECK(co_await repeat_until([&]() -> future { keys = co_await vs.ann("ks", "idx", schema, std::vector{0.1, 0.2, 0.3}, 2, as.reset()); co_return unavail_s->connections() > 1; })); @@ -845,7 +850,7 @@ SEASTAR_TEST_CASE(vector_store_client_multiple_ips_load_balancing) { // Wait until requests are handled by both servers. // The load balancing algorithm is random, so we send requests in a loop // until both servers have received at least one, verifying that load is distributed. - BOOST_CHECK(co_await repeat_until(std::chrono::seconds(10), [&]() -> future { + BOOST_CHECK(co_await repeat_until([&]() -> future { co_await vs.ann("ks", "idx", schema, std::vector{0.1, 0.2, 0.3}, 2, as.reset()); co_return !s1->requests().empty() && !s2->requests().empty(); })); @@ -875,7 +880,7 @@ SEASTAR_TEST_CASE(vector_store_client_multiple_uris_high_availability) { // Because requests are distributed in random order due to load balancing, // repeat the ANN query until the unavailable server is queried. - BOOST_CHECK(co_await repeat_until(std::chrono::seconds(10), [&]() -> future { + BOOST_CHECK(co_await repeat_until([&]() -> future { keys = co_await vs.ann("ks", "idx", schema, std::vector{0.1, 0.2, 0.3}, 2, as.reset()); co_return unavail_s->connections() > 1; })); @@ -909,7 +914,7 @@ SEASTAR_TEST_CASE(vector_store_client_multiple_uris_load_balancing) { // Wait until requests are handled by both servers. // The load balancing algorithm is random, so we send requests in a loop // until both servers have received at least one, verifying that load is distributed. - BOOST_CHECK(co_await repeat_until(std::chrono::seconds(10), [&]() -> future { + BOOST_CHECK(co_await repeat_until([&]() -> future { co_await vs.ann("ks", "idx", schema, std::vector{0.1, 0.2, 0.3}, 2, as.reset()); co_return !s1->requests().empty() && !s2->requests().empty(); }));