From 9112b543aa86620bfef5f3153411a73c3f6108cc Mon Sep 17 00:00:00 2001 From: Martin Sumner Date: Wed, 6 May 2026 11:50:49 +0100 Subject: [PATCH] Include within test a request without explicit max_results --- tests/query_json_queue.erl | 41 +++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/query_json_queue.erl b/tests/query_json_queue.erl index 3233dd1..6474e5c 100644 --- a/tests/query_json_queue.erl +++ b/tests/query_json_queue.erl @@ -326,7 +326,14 @@ test_peoplefinder_query(Nodes, ObjectCount) when ObjectCount > 3 -> {ok, {HTTP_IPL, HTTP_PortL}} = rt:get_http_conn_info(lists:last(Nodes)), - MapResponse3 = get_results(HTTP_IPL, HTTP_PortL, QueueRef, 1, false), + MapResponse3 = + get_results_with_default_max_results( + HTTP_IP, + HTTP_Port, + QueueRef, + 1, + hd(Nodes) + ), ?assertMatch(1, length(maps:get(<<"raw_keys">>, MapResponse3))), ?assertMatch(2, maps:get(<<"returned_count">>, MapResponse3)), @@ -483,6 +490,38 @@ test_peoplefinder_query(Nodes, ObjectCount) when ObjectCount > 3 -> ok = inets:stop(), ok. +get_results_with_default_max_results(HTTP_IP, HTTP_Port, QueueRef, MR, Node) -> + ok = + erpc:call( + Node, + application, + set_env, + [riak_kv, queue_raw_max_results, MR] + ), + URI = + lists:flatten( + io_lib:format( + "http://~s:~w/types/~s/buckets/~s/query" + "?result_queue=~s", + [HTTP_IP, HTTP_Port, ?BTYPE, ?BNAME, QueueRef] + ) + ), + + ?LOG_INFO("Request to URI: ~s", [URI]), + + {T, {ok, {{?VERSION, 200, "OK"}, _, ResultJson}}} = + timer:tc( + fun() -> + httpc:request(get, {URI, []}, [], [], test_client) + end + ), + {struct, DecodedResponse} = mochijson2:decode(ResultJson), + + ?LOG_INFO("Response received in ~w microseconds", [T]), + + maps:from_list(DecodedResponse). + + get_results(HTTP_IP, HTTP_Port, QueueRef, MaxResults, Quiet) -> URI = lists:flatten(