Skip to content

Commit d395f17

Browse files
dcorbachomergify[bot]
authored andcommitted
test: wait for links and metrics in prometheus_rabbitmq_federation_collector_SUITE
(cherry picked from commit 2fba241) (cherry picked from commit 3575fb5) # Conflicts: # deps/rabbitmq_prometheus/test/prometheus_rabbitmq_federation_collector_SUITE.erl
1 parent 17e36ca commit d395f17

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

deps/rabbitmq_prometheus/test/prometheus_rabbitmq_federation_collector_SUITE.erl

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,15 @@ single_link_then_second_added(Config) ->
9898
with_ch(
9999
Config,
100100
fun (Ch) ->
101-
timer:sleep(3000),
102-
[_L1] = rabbit_ct_broker_helpers:rpc(Config, 0,
103-
rabbit_federation_status, status, []),
101+
rabbit_ct_helpers:eventually(
102+
?_assertMatch([_L1],
103+
rabbit_ct_broker_helpers:rpc(
104+
Config, 0, rabbit_federation_status, status, [])),
105+
1000, 60),
104106
rabbit_ct_helpers:eventually(?_assertEqual([?ONE_RUNNING_METRIC],
105107
get_metrics(Config)),
106-
500,
107-
5),
108+
1000,
109+
30),
108110
maybe_declare_queue(Config, Ch, q(<<"fed.downstream2">>, [{<<"x-queue-type">>, longstr, <<"classic">>}])),
109111
%% here we race against queue.declare... most of the times there is going to be
110112
%% new status=starting metric. In this case we wait a bit more for running=2.
@@ -116,14 +118,20 @@ single_link_then_second_added(Config) ->
116118
[?ONE_RUNNING_METRIC] ->
117119
rabbit_ct_helpers:eventually(?_assertEqual([?TWO_RUNNING_METRIC],
118120
get_metrics(Config)),
119-
500,
120-
5);
121+
1000,
122+
30);
121123
[?ONE_RUNNING_ONE_STARTING_METRIC] ->
122124
rabbit_ct_helpers:eventually(?_assertEqual([?TWO_RUNNING_METRIC],
123125
get_metrics(Config)),
126+
<<<<<<< HEAD:deps/rabbitmq_prometheus/test/prometheus_rabbitmq_federation_collector_SUITE.erl
124127
500,
125128
5)
126129

130+
=======
131+
1000,
132+
30)
133+
134+
>>>>>>> 3575fb5492 (test: wait for links and metrics in prometheus_rabbitmq_federation_collector_SUITE):deps/rabbitmq_federation_prometheus/test/prometheus_rabbitmq_federation_collector_SUITE.erl
127135
end,
128136

129137
delete_all(Ch, [q(<<"fed.downstream2">>, [{<<"x-queue-type">>, longstr, <<"classic">>}])])
@@ -133,12 +141,15 @@ two_links_from_the_start(Config) ->
133141
with_ch(
134142
Config,
135143
fun (_Ch) ->
136-
timer:sleep(3000),
137-
[_L1 | _L2] = rabbit_ct_broker_helpers:rpc(Config, 0,
138-
rabbit_federation_status, status, []),
139-
MFs = get_metrics(Config),
140-
[?TWO_RUNNING_METRIC] = MFs
141-
144+
rabbit_ct_helpers:eventually(
145+
?_assertMatch([_L1 | _L2],
146+
rabbit_ct_broker_helpers:rpc(
147+
Config, 0, rabbit_federation_status, status, [])),
148+
1000, 60),
149+
rabbit_ct_helpers:eventually(?_assertEqual([?TWO_RUNNING_METRIC],
150+
get_metrics(Config)),
151+
1000,
152+
30)
142153
end, upstream_downstream() ++ [q(<<"fed.downstream2">>, [{<<"x-queue-type">>, longstr, <<"classic">>}])]).
143154

144155
%% -------------------------------------------------------------------

0 commit comments

Comments
 (0)