summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordcorbacho <dparracorbacho@piotal.io>2021-03-04 17:36:03 +0100
committerdcorbacho <dparracorbacho@piotal.io>2021-03-04 17:36:03 +0100
commit00510fe84b80a7a5fa1264faf48048bf4953d2b0 (patch)
tree80e5e1244d5c0c56117df1a4eae05b63d973980f
parentfd86959429eb42dae40ec3dc51aab2fa51125aec (diff)
downloadrabbitmq-server-git-00510fe84b80a7a5fa1264faf48048bf4953d2b0.tar.gz
Await for links to start/fail to start on test suite
-rw-r--r--deps/rabbitmq_federation/test/federation_status_command_SUITE.erl27
1 files changed, 16 insertions, 11 deletions
diff --git a/deps/rabbitmq_federation/test/federation_status_command_SUITE.erl b/deps/rabbitmq_federation/test/federation_status_command_SUITE.erl
index 4964ab1819..188914cee4 100644
--- a/deps/rabbitmq_federation/test/federation_status_command_SUITE.erl
+++ b/deps/rabbitmq_federation/test/federation_status_command_SUITE.erl
@@ -118,13 +118,15 @@ 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">>)]),
@@ -132,10 +134,13 @@ run_down_federated(Config) ->
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">>)]).