@@ -107,22 +107,22 @@ cluster_full_partition_with_autoheal(Config) ->
107
107
Conn4 = open_unmanaged_connection (Config , B ),
108
108
Conn5 = open_unmanaged_connection (Config , C ),
109
109
Conn6 = open_unmanaged_connection (Config , C ),
110
- ? assertEqual ( 6 , count_connections_in ( Config , VHost ) ),
110
+ wait_for_count_connections_in ( Config , VHost , 6 , 60000 ),
111
111
112
112
% % B drops off the network, non-reachable by either A or C
113
113
rabbit_ct_broker_helpers :block_traffic_between (A , B ),
114
114
rabbit_ct_broker_helpers :block_traffic_between (B , C ),
115
115
timer :sleep (? DELAY ),
116
116
117
117
% % A and C are still connected, so 4 connections are tracked
118
- ? assertEqual ( 4 , count_connections_in ( Config , VHost ) ),
118
+ wait_for_count_connections_in ( Config , VHost , 4 , 60000 ),
119
119
120
120
rabbit_ct_broker_helpers :allow_traffic_between (A , B ),
121
121
rabbit_ct_broker_helpers :allow_traffic_between (B , C ),
122
122
timer :sleep (? DELAY ),
123
123
124
124
% % during autoheal B's connections were dropped
125
- ? assertEqual ( 4 , count_connections_in ( Config , VHost ) ),
125
+ wait_for_count_connections_in ( Config , VHost , 4 , 60000 ),
126
126
127
127
lists :foreach (fun (Conn ) ->
128
128
(catch rabbit_ct_client_helpers :close_connection (Conn ))
@@ -131,11 +131,22 @@ cluster_full_partition_with_autoheal(Config) ->
131
131
132
132
passed .
133
133
134
-
135
134
% % -------------------------------------------------------------------
136
135
% % Helpers
137
136
% % -------------------------------------------------------------------
138
137
138
+ wait_for_count_connections_in (Config , VHost , Expected , Time ) when Time =< 0 ->
139
+ ? assertEqual (Expected , count_connections_in (Config , VHost ));
140
+ wait_for_count_connections_in (Config , VHost , Expected , Time ) ->
141
+ case count_connections_in (Config , VHost ) of
142
+ Expected ->
143
+ ok ;
144
+ _ ->
145
+ Sleep = 3000 ,
146
+ timer :sleep (Sleep ),
147
+ wait_for_count_connections_in (Config , VHost , Expected , Time - Sleep )
148
+ end .
149
+
139
150
count_connections_in (Config , VHost ) ->
140
151
count_connections_in (Config , VHost , 0 ).
141
152
count_connections_in (Config , VHost , NodeIndex ) ->
0 commit comments