Skip to content

Commit ff9301c

Browse files
committed
Fix test flake
Sometimes on Khepri the test failed with: ``` === Ended at 2024-07-24 10:07:15 === Location: [{gen_server,call,419}, {amqpl_direct_reply_to_SUITE,rpc,226}, {test_server,ts_tc,1793}, {test_server,run_test_case_eval1,1302}, {test_server,run_test_case_eval,1234}] === === Reason: {{shutdown, {server_initiated_close,404, <<"NOT_FOUND - no queue 'tests.amqpl_direct_reply_to.rpc.requests' in vhost '/'">>}}, {gen_server,call, [<0.272.0>, {call, {'basic.get',0, <<"tests.amqpl_direct_reply_to.rpc.requests">>, false}, none,<0.246.0>}, infinity]}} ``` https://github.com/rabbitmq/rabbitmq-server/actions/runs/10074558971/job/27851173817?pr=11809 shows an instance of this flake. (cherry picked from commit be6a7fe)
1 parent 3307428 commit ff9301c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

deps/rabbit/test/amqpl_direct_reply_to_SUITE.erl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
-compile([nowarn_export_all,
1515
export_all]).
1616

17+
-import(rabbit_ct_helpers, [eventually/1]).
18+
1719
all() ->
1820
[
1921
{group, cluster_size_1},
@@ -218,6 +220,7 @@ rpc(RequesterNode, ResponderNode, Config) ->
218220
after 5000 -> ct:fail(confirm_timeout)
219221
end,
220222

223+
ok = wait_for_queue_declared(RequestQueue, ResponderNode, Config),
221224
%% Receive the request.
222225
{#'basic.get_ok'{},
223226
#amqp_msg{props = #'P_basic'{reply_to = ReplyTo,
@@ -238,3 +241,15 @@ rpc(RequesterNode, ResponderNode, Config) ->
238241
ok
239242
after 5000 -> ct:fail(missing_reply)
240243
end.
244+
245+
wait_for_queue_declared(Queue, Node, Config) ->
246+
eventually(
247+
?_assert(
248+
begin
249+
Ch = rabbit_ct_client_helpers:open_channel(Config, Node),
250+
#'queue.declare_ok'{} = amqp_channel:call(
251+
Ch, #'queue.declare'{queue = Queue,
252+
passive = true}),
253+
rabbit_ct_client_helpers:close_channel(Ch),
254+
true
255+
end)).

0 commit comments

Comments
 (0)