@@ -46,7 +46,8 @@ merge_app_env(Config) ->
4646 rabbit_ct_helpers :merge_app_env (Config ,
4747 {rabbit , [
4848 {collect_statistics , fine },
49- {collect_statistics_interval , 500 }
49+ {collect_statistics_interval , 500 },
50+ {core_metrics_gc_interval , 5000 }
5051 ]}).
5152init_per_suite (Config ) ->
5253 rabbit_ct_helpers :log_environment (),
@@ -186,6 +187,10 @@ queue_metric_idemp(Config, {N, R}) ->
186187 Queue
187188 end || _ <- lists :seq (1 , N )],
188189
190+ ? awaitMatch (N , length (read_table_rpc (Config , queue_metrics )),
191+ 30000 ),
192+ ? awaitMatch (N , length (read_table_rpc (Config , queue_coarse_metrics )),
193+ 30000 ),
189194 Table = [ Pid || {Pid , _ , _ } <- read_table_rpc (Config , queue_metrics )],
190195 Table2 = [ Pid || {Pid , _ , _ } <- read_table_rpc (Config , queue_coarse_metrics )],
191196 % refresh stats 'R' times
@@ -195,12 +200,16 @@ queue_metric_idemp(Config, {N, R}) ->
195200 gen_server2 :call (Pid , flush )
196201 end || {Pid , _ , _ } <- ChanTable ] || _ <- lists :seq (1 , R )],
197202 force_metric_gc (Config ),
203+ ? awaitMatch (N , length (read_table_rpc (Config , queue_metrics )),
204+ 30000 ),
205+ ? awaitMatch (N , length (read_table_rpc (Config , queue_coarse_metrics )),
206+ 30000 ),
198207 TableAfter = [ Pid || {Pid , _ , _ } <- read_table_rpc (Config , queue_metrics )],
199208 TableAfter2 = [ Pid || {Pid , _ , _ } <- read_table_rpc (Config , queue_coarse_metrics )],
200209 [ delete_queue (Chan , Q ) || Q <- Queues ],
201210 rabbit_ct_client_helpers :close_connection (Conn ),
202- (Table2 == TableAfter2 ) and ( Table == TableAfter ) and
203- ( N == length ( Table )) and (N == length (TableAfter )).
211+ (lists : sort ( Table2 ) == lists : sort ( TableAfter2 ))
212+ and (lists : sort ( Table ) == lists : sort (TableAfter )).
204213
205214connection_metric_count (Config , Ops ) ->
206215 add_rem_counter (Config , Ops ,
@@ -293,9 +302,12 @@ connection(Config) ->
293302 [_ ] = read_table_rpc (Config , connection_coarse_metrics ),
294303 ok = rabbit_ct_client_helpers :close_connection (Conn ),
295304 force_metric_gc (Config ),
296- [] = read_table_rpc (Config , connection_created ),
297- [] = read_table_rpc (Config , connection_metrics ),
298- [] = read_table_rpc (Config , connection_coarse_metrics ),
305+ ? awaitMatch ([], read_table_rpc (Config , connection_created ),
306+ 30000 ),
307+ ? awaitMatch ([], read_table_rpc (Config , connection_metrics ),
308+ 30000 ),
309+ ? awaitMatch ([], read_table_rpc (Config , connection_coarse_metrics ),
310+ 30000 ),
299311 ok .
300312
301313channel (Config ) ->
0 commit comments