Skip to content

Commit 0ec41c6

Browse files
committed
Shovel: de-flake dynamic_SUITE
checking that not a single process has a message in the mailbox is prone to flakes.
1 parent 005bb2c commit 0ec41c6

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

deps/rabbitmq_shovel/test/dynamic_SUITE.erl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
-include_lib("eunit/include/eunit.hrl").
1111
-include_lib("amqp_client/include/amqp_client.hrl").
1212

13+
-import(rabbit_ct_helpers, [eventually/1]).
14+
1315
-compile(export_all).
1416

1517
-export([spawn_suspender_proc/1]).
@@ -696,9 +698,11 @@ credit_flow(Config) ->
696698
5000),
697699

698700
%% There should be only one process with a message buildup
699-
[{WriterPid, MQLen, _}, {_, 0, _} | _] =
701+
Top = [{WriterPid, MQLen, _}, {_, P, _} | _] =
700702
rabbit_ct_broker_helpers:rpc(
701703
Config, 0, recon, proc_count, [message_queue_len, 10]),
704+
ct:pal("Top processes by message queue length: ~p", [Top]),
705+
?assert(P < 3),
702706

703707
%% The writer process should have only a limited
704708
%% message queue. The shovel stops sending messages
@@ -725,9 +729,10 @@ credit_flow(Config) ->
725729
end,
726730
5000),
727731
#{messages := 1000} = message_count(Config, <<"dest">>),
728-
[{_, 0, _}] =
732+
[{_, P, _}] =
729733
rabbit_ct_broker_helpers:rpc(
730734
Config, 0, recon, proc_count, [message_queue_len, 1]),
735+
?assert(P < 3),
731736

732737
%% Status only transitions from flow to running
733738
%% after a 1 second state-change-interval
@@ -839,9 +844,12 @@ dest_resource_alarm(AckMode, Config) ->
839844
MsgCnts = message_count(Config, <<"src">>),
840845

841846
%% There should be no process with a message buildup
842-
[{_, 0, _}] =
843-
rabbit_ct_broker_helpers:rpc(
844-
Config, 0, recon, proc_count, [message_queue_len, 1]),
847+
eventually(?_assertEqual(0, begin
848+
Top = [{_, P, _}] = rabbit_ct_broker_helpers:rpc(
849+
Config, 0, recon, proc_count, [message_queue_len, 1]),
850+
ct:pal("Top process by message queue length: ~p", [Top]),
851+
P
852+
end)),
845853

846854
%% Clear the resource alarm, all messages should
847855
%% arrive to the dest queue

0 commit comments

Comments
 (0)