From a65ffdd0df86c5f285239201b6fc0a5f84d9c33a Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 29 May 2025 19:47:06 +0300 Subject: [PATCH] test/result_utils: Do not assume map_reduce reducing order When map_reduce is called on a collection, one shouldn't expect that it processes the elements of the collection in any specific order. Current test of map-reduce over boost outcome assumes that if reduce function is the string concatenation, then it would concatenate the given vector of strings in the order they are listed. That requirement should be relaxed, and the result may have reversed concatentation. Fixes scylladb/scylladb#24321 Signed-off-by: Pavel Emelyanov Closes scylladb/scylladb#24325 --- test/boost/result_utils_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/boost/result_utils_test.cc b/test/boost/result_utils_test.cc index 59ff4009e2..4de38633de 100644 --- a/test/boost/result_utils_test.cc +++ b/test/boost/result_utils_test.cc @@ -242,7 +242,8 @@ SEASTAR_THREAD_TEST_CASE(test_result_map_reduce) { auto bar_exc = [] () { return result(bo::failure(bar_exception())); }; auto foo_throw = [] () { return make_exception_future>(foo_exception()); }; - BOOST_REQUIRE_EQUAL(reduce(sstring("brown"), sstring("fox")).value(), "the brown fox"); + auto res = reduce(sstring("brown"), sstring("fox")).value(); + BOOST_REQUIRE(res == "the brown fox" || res == "the fox brown"); BOOST_REQUIRE_EQUAL(reduce(foo_exc(), sstring("fox")).error(), exc_container(foo_exception())); BOOST_REQUIRE_EQUAL(reduce(sstring("brown"), foo_exc()).error(), exc_container(foo_exception())); BOOST_REQUIRE_EQUAL(reduce(foo_exc(), bar_exc()).error(), exc_container(foo_exception()));