Skip to content

Commit 88139c4

Browse files
committed
Test publish and queue length after restart
[#154472174]
1 parent 9b53bfe commit 88139c4

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

test/quorum_queue_SUITE.erl

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ groups() ->
3636
restart_queue,
3737
restart_all_types,
3838
stop_start_rabbit_app,
39-
publish_to_queue
39+
publish_to_queue,
40+
publish_and_restart
4041
]}
4142
].
4243

@@ -241,12 +242,28 @@ publish_to_queue(Config) ->
241242
?assertEqual({'queue.declare_ok', QQ, 0, 0},
242243
declare(Ch, QQ, [{<<"x-queue-type">>, longstr, <<"quorum">>}])),
243244

244-
ok = amqp_channel:call(Ch,
245-
#'basic.publish'{routing_key = QQ},
246-
#amqp_msg{props = #'P_basic'{delivery_mode = 2},
247-
payload = <<"msg">>}),
245+
publish(Ch, QQ),
248246
wait_for_messages(Config, 0, QQ, <<"1">>).
249247

248+
publish_and_restart(Config) ->
249+
%% Test the node restart with both types of queues (quorum and classic) to
250+
%% ensure there are no regressions
251+
Node = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
252+
253+
Ch = rabbit_ct_client_helpers:open_channel(Config, Node),
254+
QQ = <<"quorum-q1">>,
255+
?assertEqual({'queue.declare_ok', QQ, 0, 0},
256+
declare(Ch, QQ, [{<<"x-queue-type">>, longstr, <<"quorum">>}])),
257+
publish(Ch, QQ),
258+
wait_for_messages(Config, 0, QQ, <<"1">>),
259+
260+
ok = rabbit_ct_broker_helpers:stop_node(Config, Node),
261+
ok = rabbit_ct_broker_helpers:start_node(Config, Node),
262+
263+
wait_for_messages(Config, 0, QQ, <<"1">>),
264+
publish(rabbit_ct_client_helpers:open_channel(Config, Node), QQ),
265+
wait_for_messages(Config, 0, QQ, <<"2">>).
266+
250267
%%----------------------------------------------------------------------------
251268

252269
declare(Ch, Q) ->
@@ -283,3 +300,9 @@ wait_for_messages(Config, Node, Queue, Count, N) ->
283300
timer:sleep(500),
284301
wait_for_messages(Config, Node, Queue, Count, N - 1)
285302
end.
303+
304+
publish(Ch, Queue) ->
305+
ok = amqp_channel:call(Ch,
306+
#'basic.publish'{routing_key = Queue},
307+
#amqp_msg{props = #'P_basic'{delivery_mode = 2},
308+
payload = <<"msg">>}).

0 commit comments

Comments
 (0)