Skip to content

Commit dfe0f4b

Browse files
author
Loïc Hoguin
committed
Clear federation before deleting message_flow queues
Without this change the test could take a very long time to cleanup the queues and finish because of a race condition between the queue deletion and the federation link being restarted and declaring the queue again. (The test bidirectional was renamed to message_flow to better represent what it is doing.)
1 parent 180ce56 commit dfe0f4b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

deps/rabbitmq_federation/test/queue_SUITE.erl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
-import(rabbit_federation_test_util,
1717
[wait_for_federation/2, expect/3, expect/4,
18-
set_upstream/4, set_upstream/5, clear_upstream/3, set_policy/5, clear_policy/3,
18+
set_upstream/4, set_upstream/5, clear_upstream/3, clear_upstream_set/3,
19+
set_policy/5, clear_policy/3,
1920
set_policy_pattern/5, set_policy_upstream/5, q/2, with_ch/3,
2021
maybe_declare_queue/3, delete_queue/2,
2122
federation_links_in_vhost/3]).
@@ -35,7 +36,7 @@ groups() ->
3536
multiple_upstreams,
3637
multiple_upstreams_pattern,
3738
multiple_downstreams,
38-
bidirectional,
39+
message_flow,
3940
dynamic_reconfiguration,
4041
federate_unfederate,
4142
dynamic_plugin_stop_start
@@ -239,7 +240,7 @@ multiple_downstreams(Config) ->
239240
expect_federation(Ch, <<"upstream">>, <<"fed.downstream2">>, ?EXPECT_FEDERATION_TIMEOUT)
240241
end, upstream_downstream(Config) ++ [q(<<"fed.downstream2">>, Args)]).
241242

242-
bidirectional(Config) ->
243+
message_flow(Config) ->
243244
%% TODO: specifc source / target here
244245
Args = ?config(source_queue_args, Config),
245246
with_ch(Config,
@@ -257,7 +258,13 @@ bidirectional(Config) ->
257258
[publish(Ch, <<>>, <<"two">>, <<"bulk">>) || _ <- Seq],
258259
expect(Ch, <<"two">>, repeat(100, <<"bulk">>)),
259260
expect_empty(Ch, <<"one">>),
260-
expect_empty(Ch, <<"two">>)
261+
expect_empty(Ch, <<"two">>),
262+
%% We clear the federation configuration to avoid a race condition
263+
%% when deleting the queues in quorum mode. The federation link
264+
%% would restart and lead to a state where nothing happened for
265+
%% minutes.
266+
clear_upstream_set(Config, 0, <<"one">>),
267+
clear_upstream_set(Config, 0, <<"two">>)
261268
end, [q(<<"one">>, Args),
262269
q(<<"two">>, Args)]).
263270

0 commit comments

Comments
 (0)