Skip to content

Commit

Permalink
Merge pull request #12505 from rabbitmq/mergify/bp/v4.0.x/pr-12501
Browse files Browse the repository at this point in the history
Tests: wait until stats are published, not just collected on the agent (backport #12501)
  • Loading branch information
michaelklishin authored Oct 11, 2024
2 parents 1608ab4 + af85d9d commit 7b036be
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion deps/rabbitmq_management/test/clustering_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ queue_on_other_node(Config) ->
consume(Chan2, <<"some-queue">>),

force_stats(Config),
Res = http_get(Config, "/queues/%2F/some-queue"),
?awaitMatch([_], maps:get(consumer_details, http_get(Config, "/queues/%2F/some-queue")), 60000),

Res = http_get(Config, "/queues/%2F/some-queue"),
% assert some basic data is present
[Cons] = maps:get(consumer_details, Res),
#{} = maps:get(channel_details, Cons), % channel details proplist must not be empty
Expand Down
15 changes: 14 additions & 1 deletion deps/rabbitmq_management/test/clustering_prop_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ prop_connection_channel_counts(Config) ->
execute_op(Config, Op, Agg)
end, [], Ops),
force_stats(Config),
Res = validate_counts(Config, Cons),
%% TODO retry a few times
Res = retry_for(
fun() -> validate_counts(Config, Cons) end,
60),
cleanup(Cons),
rabbit_ct_helpers:await_condition(
fun () -> validate_counts(Config, []) end,
Expand Down Expand Up @@ -275,3 +278,13 @@ dump_table(Config, Table) ->
Data0 = rabbit_ct_broker_helpers:rpc(Config, 1, ets, tab2list, [Table]),
ct:pal(?LOW_IMPORTANCE, "Node 1: Dump of table ~tp:~n~tp~n", [Table, Data0]).

retry_for(Fun, 0) ->
false;
retry_for(Fun, Retries) ->
case Fun() of
true ->
true;
false ->
timer:sleep(1000),
retry_for(Fun, Retries - 1)
end.

0 comments on commit 7b036be

Please sign in to comment.