Skip to content

Commit 583d13c

Browse files
committed
queue_SUITE: use a different upstream for each queue on multi-federation tests
1 parent 385b7e4 commit 583d13c

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

Diff for: deps/rabbitmq_federation/test/queue_SUITE.erl

+15-13
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ multiple_downstreams(Config) ->
201201
fun (Ch) ->
202202
timer:sleep(?INITIAL_WAIT),
203203
expect_federation(Config, Ch, <<"upstream">>, <<"fed.downstream">>, ?EXPECT_FEDERATION_TIMEOUT),
204-
expect_federation(Config, Ch, <<"upstream">>, <<"fed.downstream2">>, ?EXPECT_FEDERATION_TIMEOUT)
205-
end, upstream_downstream(Config) ++ [q(<<"fed.downstream2">>, Args)]).
204+
expect_federation(Config, Ch, <<"upstream2">>, <<"fed2.downstream">>, ?EXPECT_FEDERATION_TIMEOUT)
205+
end, upstream_downstream(Config) ++ [q(<<"fed2.downstream">>, Args)]).
206206

207207
message_flow(Config) ->
208208
%% TODO: specifc source / target here
@@ -258,36 +258,37 @@ federate_unfederate(Config) ->
258258
fun (Ch) ->
259259
timer:sleep(?INITIAL_WAIT),
260260
expect_federation(Config, Ch, <<"upstream">>, <<"fed.downstream">>, ?EXPECT_FEDERATION_TIMEOUT),
261-
expect_federation(Config, Ch, <<"upstream">>, <<"fed.downstream2">>, ?EXPECT_FEDERATION_TIMEOUT),
261+
expect_federation(Config, Ch, <<"upstream2">>, <<"fed2.downstream">>, ?EXPECT_FEDERATION_TIMEOUT),
262262

263263
%% clear the policy
264264
rabbit_ct_broker_helpers:clear_policy(Config, 0, <<"fed">>),
265265

266266
expect_no_federation(Ch, <<"upstream">>, <<"fed.downstream">>),
267-
expect_no_federation(Ch, <<"upstream">>, <<"fed.downstream2">>),
267+
expect_no_federation(Ch, <<"upstream2">>, <<"fed2.downstream">>),
268268

269269
rabbit_ct_broker_helpers:set_policy(Config, 0,
270270
<<"fed">>, <<"^fed\.">>, <<"all">>, [
271271
{<<"federation-upstream-set">>, <<"upstream">>}])
272-
end, upstream_downstream(Config) ++ [q(<<"fed.downstream2">>, Args)]).
272+
end, upstream_downstream(Config) ++ [q(<<"fed2.downstream">>, Args)]).
273273

274274
dynamic_plugin_stop_start(Config) ->
275-
DownQ2 = <<"fed.downstream2">>,
275+
DownQ2 = <<"fed2.downstream">>,
276276
Args = ?config(target_queue_args, Config),
277277
with_ch(Config,
278278
fun (Ch) ->
279279
timer:sleep(?INITIAL_WAIT),
280-
UpQ = <<"upstream">>,
280+
UpQ1 = <<"upstream">>,
281+
UpQ2 = <<"upstream2">>,
281282
DownQ1 = <<"fed.downstream">>,
282-
expect_federation(Config, Ch, UpQ, DownQ1, ?EXPECT_FEDERATION_TIMEOUT),
283-
expect_federation(Config, Ch, UpQ, DownQ2, ?EXPECT_FEDERATION_TIMEOUT),
283+
expect_federation(Config, Ch, UpQ1, DownQ1, ?EXPECT_FEDERATION_TIMEOUT),
284+
expect_federation(Config, Ch, UpQ2, DownQ2, ?EXPECT_FEDERATION_TIMEOUT),
284285

285286
%% Disable the plugin, the link disappears
286287
ct:pal("Stopping rabbitmq_federation"),
287288
ok = rabbit_ct_broker_helpers:disable_plugin(Config, 0, "rabbitmq_federation"),
288289

289-
expect_no_federation(Ch, UpQ, DownQ1),
290-
expect_no_federation(Ch, UpQ, DownQ2),
290+
expect_no_federation(Ch, UpQ1, DownQ1),
291+
expect_no_federation(Ch, UpQ2, DownQ2),
291292

292293
maybe_declare_queue(Config, Ch, q(DownQ1, Args)),
293294
maybe_declare_queue(Config, Ch, q(DownQ2, Args)),
@@ -305,12 +306,13 @@ dynamic_plugin_stop_start(Config) ->
305306
Entry || Entry <- Status,
306307
proplists:get_value(queue, Entry) =:= DownQ1 orelse
307308
proplists:get_value(queue, Entry) =:= DownQ2,
308-
proplists:get_value(upstream_queue, Entry) =:= UpQ,
309+
proplists:get_value(upstream_queue, Entry) =:= UpQ1 orelse
310+
proplists:get_value(upstream_queue, Entry) =:= UpQ2,
309311
proplists:get_value(status, Entry) =:= running
310312
],
311313
length(L) =:= 2
312314
end),
313-
expect_federation(Config, Ch, UpQ, DownQ1, 120000)
315+
expect_federation(Config, Ch, UpQ1, DownQ1, 120000)
314316
end, upstream_downstream(Config) ++ [q(DownQ2, Args)]).
315317

316318
restart_upstream(Config) ->

Diff for: deps/rabbitmq_federation/test/rabbit_federation_test_util.erl

+8-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ setup_federation_with_upstream_params(Config, ExtraParams) ->
9696

9797
rabbit_ct_broker_helpers:rpc(
9898
Config, 0, rabbit_policy, set,
99-
[<<"/">>, <<"fed">>, <<"^fed\.">>, [{<<"federation-upstream-set">>, <<"upstream">>}],
99+
[<<"/">>, <<"fed">>, <<"^fed\\.">>, [{<<"federation-upstream-set">>, <<"upstream">>}],
100+
0, <<"all">>, <<"acting-user">>]),
101+
102+
rabbit_ct_broker_helpers:rpc(
103+
Config, 0, rabbit_policy, set,
104+
[<<"/">>, <<"fed2">>, <<"^fed2\\.">>, [{<<"federation-upstream-set">>, <<"upstream2">>}],
100105
0, <<"all">>, <<"acting-user">>]),
101106

102107
rabbit_ct_broker_helpers:rpc(
@@ -144,10 +149,10 @@ setup_down_federation(Config) ->
144149
{<<"queue">>, <<"upstream">>}]]),
145150
rabbit_ct_broker_helpers:set_policy(
146151
Config, 0,
147-
<<"fed">>, <<"^fed\.">>, <<"all">>, [{<<"federation-upstream-set">>, <<"upstream">>}]),
152+
<<"fed">>, <<"^fed\\.">>, <<"all">>, [{<<"federation-upstream-set">>, <<"upstream">>}]),
148153
rabbit_ct_broker_helpers:set_policy(
149154
Config, 0,
150-
<<"fed">>, <<"^fed\.">>, <<"all">>, [{<<"federation-upstream-set">>, <<"upstream">>}]),
155+
<<"fed">>, <<"^fed\\.">>, <<"all">>, [{<<"federation-upstream-set">>, <<"upstream">>}]),
151156
Config.
152157

153158
wait_for_federation(Retries, Fun) ->

0 commit comments

Comments
 (0)