From 3575fb5492b015cb321ae081f5db88c42d1e9b48 Mon Sep 17 00:00:00 2001 From: Diana Parra Corbacho Date: Mon, 4 Nov 2024 08:42:42 +0100 Subject: [PATCH] test: wait for links and metrics in prometheus_rabbitmq_federation_collector_SUITE (cherry picked from commit 2fba2419d3f257fb488b22fd22f31e3866adcfaf) --- ...us_rabbitmq_federation_collector_SUITE.erl | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/deps/rabbitmq_federation_prometheus/test/prometheus_rabbitmq_federation_collector_SUITE.erl b/deps/rabbitmq_federation_prometheus/test/prometheus_rabbitmq_federation_collector_SUITE.erl index 92947807fa2c..a08163af06c6 100644 --- a/deps/rabbitmq_federation_prometheus/test/prometheus_rabbitmq_federation_collector_SUITE.erl +++ b/deps/rabbitmq_federation_prometheus/test/prometheus_rabbitmq_federation_collector_SUITE.erl @@ -91,13 +91,15 @@ single_link_then_second_added(Config) -> with_ch( Config, fun (Ch) -> - timer:sleep(3000), - [_L1] = rabbit_ct_broker_helpers:rpc(Config, 0, - rabbit_federation_status, status, []), + rabbit_ct_helpers:eventually( + ?_assertMatch([_L1], + rabbit_ct_broker_helpers:rpc( + Config, 0, rabbit_federation_status, status, [])), + 1000, 60), rabbit_ct_helpers:eventually(?_assertEqual([?ONE_RUNNING_METRIC], get_metrics(Config)), - 500, - 5), + 1000, + 30), maybe_declare_queue(Config, Ch, q(<<"fed.downstream2">>, [{<<"x-queue-type">>, longstr, <<"classic">>}])), %% here we race against queue.declare... most of the times there is going to be %% new status=starting metric. In this case we wait a bit more for running=2. @@ -109,13 +111,13 @@ single_link_then_second_added(Config) -> [?ONE_RUNNING_METRIC] -> rabbit_ct_helpers:eventually(?_assertEqual([?TWO_RUNNING_METRIC], get_metrics(Config)), - 500, - 5); + 1000, + 30); [?ONE_RUNNING_ONE_STARTING_METRIC] -> rabbit_ct_helpers:eventually(?_assertEqual([?TWO_RUNNING_METRIC], get_metrics(Config)), - 500, - 5) + 1000, + 30) end, @@ -126,12 +128,15 @@ two_links_from_the_start(Config) -> with_ch( Config, fun (_Ch) -> - timer:sleep(3000), - [_L1 | _L2] = rabbit_ct_broker_helpers:rpc(Config, 0, - rabbit_federation_status, status, []), - MFs = get_metrics(Config), - [?TWO_RUNNING_METRIC] = MFs - + rabbit_ct_helpers:eventually( + ?_assertMatch([_L1 | _L2], + rabbit_ct_broker_helpers:rpc( + Config, 0, rabbit_federation_status, status, [])), + 1000, 60), + rabbit_ct_helpers:eventually(?_assertEqual([?TWO_RUNNING_METRIC], + get_metrics(Config)), + 1000, + 30) end, upstream_downstream() ++ [q(<<"fed.downstream2">>, [{<<"x-queue-type">>, longstr, <<"classic">>}])]). %% -------------------------------------------------------------------