summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2019-01-08 11:21:54 +0100
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2019-01-08 12:50:56 +0100
commit1e2a202fcba50dcdce33ca363f93dd06fe78ebf9 (patch)
treeb1ade3fc6b32f87a950f661b0986a5100bc63e78 /test
parent5a1da3c4d5bf6542adadd3ad5a0e6efded49e90a (diff)
downloadrabbitmq-server-git-1e2a202fcba50dcdce33ca363f93dd06fe78ebf9.tar.gz
per_vhost_connection_limit_partitions: Check connections count in a loop
It should fix transient failures in CI.
Diffstat (limited to 'test')
-rw-r--r--test/per_vhost_connection_limit_partitions_SUITE.erl19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/per_vhost_connection_limit_partitions_SUITE.erl b/test/per_vhost_connection_limit_partitions_SUITE.erl
index 051f3f13b7..20adf704a0 100644
--- a/test/per_vhost_connection_limit_partitions_SUITE.erl
+++ b/test/per_vhost_connection_limit_partitions_SUITE.erl
@@ -107,7 +107,7 @@ cluster_full_partition_with_autoheal(Config) ->
Conn4 = open_unmanaged_connection(Config, B),
Conn5 = open_unmanaged_connection(Config, C),
Conn6 = open_unmanaged_connection(Config, C),
- ?assertEqual(6, count_connections_in(Config, VHost)),
+ wait_for_count_connections_in(Config, VHost, 6, 60000),
%% B drops off the network, non-reachable by either A or C
rabbit_ct_broker_helpers:block_traffic_between(A, B),
@@ -115,14 +115,14 @@ cluster_full_partition_with_autoheal(Config) ->
timer:sleep(?DELAY),
%% A and C are still connected, so 4 connections are tracked
- ?assertEqual(4, count_connections_in(Config, VHost)),
+ wait_for_count_connections_in(Config, VHost, 4, 60000),
rabbit_ct_broker_helpers:allow_traffic_between(A, B),
rabbit_ct_broker_helpers:allow_traffic_between(B, C),
timer:sleep(?DELAY),
%% during autoheal B's connections were dropped
- ?assertEqual(4, count_connections_in(Config, VHost)),
+ wait_for_count_connections_in(Config, VHost, 4, 60000),
lists:foreach(fun (Conn) ->
(catch rabbit_ct_client_helpers:close_connection(Conn))
@@ -131,11 +131,22 @@ cluster_full_partition_with_autoheal(Config) ->
passed.
-
%% -------------------------------------------------------------------
%% Helpers
%% -------------------------------------------------------------------
+wait_for_count_connections_in(Config, VHost, Expected, Time) when Time =< 0 ->
+ ?assertEqual(Expected, count_connections_in(Config, VHost));
+wait_for_count_connections_in(Config, VHost, Expected, Time) ->
+ case count_connections_in(Config, VHost) of
+ Expected ->
+ ok;
+ _ ->
+ Sleep = 3000,
+ timer:sleep(Sleep),
+ wait_for_count_connections_in(Config, VHost, Expected, Time - Sleep)
+ end.
+
count_connections_in(Config, VHost) ->
count_connections_in(Config, VHost, 0).
count_connections_in(Config, VHost, NodeIndex) ->