Skip to content

Commit

Permalink
Await for links to start/fail to start on test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
dcorbacho committed Mar 4, 2021
1 parent fd86959 commit 00510fe
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions deps/rabbitmq_federation/test/federation_status_command_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,29 @@ run_down_federated(Config) ->
rabbit_federation_test_util:with_ch(
Config,
fun(_) ->
timer:sleep(3000),
{stream, ManyProps} = ?CMD:run([], Opts#{only_down => false}),
Links = [{proplists:get_value(upstream, Props),
proplists:get_value(status, Props)}
|| Props <- ManyProps],
[{<<"broken-bunny">>, error}, {<<"localhost">>, running}]
= lists:sort(Links)
rabbit_ct_helpers:await_condition(
fun() ->
{stream, ManyProps} = ?CMD:run([], Opts#{only_down => false}),
Links = [{proplists:get_value(upstream, Props),
proplists:get_value(status, Props)}
|| Props <- ManyProps],
[{<<"broken-bunny">>, error}, {<<"localhost">>, running}]
== lists:sort(Links)
end, 15000)
end,
[rabbit_federation_test_util:q(<<"upstream">>),
rabbit_federation_test_util:q(<<"fed.downstream">>)]),
%% Down
rabbit_federation_test_util:with_ch(
Config,
fun(_) ->
timer:sleep(3000),
{stream, [Props]} = ?CMD:run([], Opts#{only_down => true}),
<<"broken-bunny">> = proplists:get_value(upstream, Props),
error = proplists:get_value(status, Props)
rabbit_ct_helpers:await_condition(
fun() ->
{stream, Props} = ?CMD:run([], Opts#{only_down => true}),
(length(Props) == 1)
andalso (<<"broken-bunny">> == proplists:get_value(upstream, hd(Props)))
andalso (error == proplists:get_value(status, hd(Props)))
end, 15000)
end,
[rabbit_federation_test_util:q(<<"upstream">>),
rabbit_federation_test_util:q(<<"fed.downstream">>)]).
Expand Down

0 comments on commit 00510fe

Please sign in to comment.