From fb15c83f12b9e376d4df1ce6decdd8d69a04a248 Mon Sep 17 00:00:00 2001 From: Diana Parra Corbacho Date: Thu, 10 Oct 2024 12:34:59 +0200 Subject: [PATCH 1/2] Tests: wait until stats are published, not just collected on the agent (cherry picked from commit 45718fbcf609375fa110961f5afbcb0f2ac6d52a) --- deps/rabbitmq_management/test/clustering_SUITE.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deps/rabbitmq_management/test/clustering_SUITE.erl b/deps/rabbitmq_management/test/clustering_SUITE.erl index fa7804d9174b..3febd56db0ff 100644 --- a/deps/rabbitmq_management/test/clustering_SUITE.erl +++ b/deps/rabbitmq_management/test/clustering_SUITE.erl @@ -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 From af85d9d9420e4c503ecab1d671ad4d4b2cd5515b Mon Sep 17 00:00:00 2001 From: Diana Parra Corbacho Date: Thu, 10 Oct 2024 12:57:14 +0200 Subject: [PATCH 2/2] Tests: wait until stats are published, not just collected on the agent (cherry picked from commit 7d45609b1a307920d8ea47833fe40c497987bafb) --- .../test/clustering_prop_SUITE.erl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/deps/rabbitmq_management/test/clustering_prop_SUITE.erl b/deps/rabbitmq_management/test/clustering_prop_SUITE.erl index 7ade6ece5b40..a56832f898e9 100644 --- a/deps/rabbitmq_management/test/clustering_prop_SUITE.erl +++ b/deps/rabbitmq_management/test/clustering_prop_SUITE.erl @@ -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, @@ -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.