Skip to content

Commit 4409bdd

Browse files
dumbbellmergify[bot]
authored andcommitted
quorum_queue_SUITE: Improve reliability of a test
... by waiting for a state. (cherry picked from commit 9704d23) (cherry picked from commit 98e80bc)
1 parent ed1a37f commit 4409bdd

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

deps/rabbit/test/quorum_queue_SUITE.erl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,11 +2423,21 @@ confirm_availability_on_leader_change(Config) ->
24232423
ok.
24242424

24252425
wait_for_new_messages(Config, Node, Name, Increase) ->
2426+
wait_for_new_messages(Config, Node, Name, Increase, 60000).
2427+
2428+
wait_for_new_messages(Config, Node, Name, Increase, Timeout) ->
24262429
Infos = rabbit_ct_broker_helpers:rabbitmqctl_list(
24272430
Config, Node, ["list_queues", "name", "messages"]),
2428-
[[Name, Msgs0]] = [Props || Props <- Infos, hd(Props) == Name],
2429-
Msgs = binary_to_integer(Msgs0),
2430-
queue_utils:wait_for_min_messages(Config, Name, Msgs + Increase).
2431+
case [Props || Props <- Infos, hd(Props) == Name] of
2432+
[[Name, Msgs0]] ->
2433+
Msgs = binary_to_integer(Msgs0),
2434+
queue_utils:wait_for_min_messages(Config, Name, Msgs + Increase);
2435+
_ when Timeout >= 0 ->
2436+
Sleep = 200,
2437+
timer:sleep(Sleep),
2438+
wait_for_new_messages(
2439+
Config, Node, Name, Increase, Timeout - Sleep)
2440+
end.
24312441

24322442
flush(T) ->
24332443
receive X ->

0 commit comments

Comments
 (0)