handle exceptions in rabbit_ct_helpers:await_condition_with_retries/2 and continue waiting

(cherry picked from commit faca67b5e6)
This commit is contained in:
Ayanda Dube 2025-07-22 11:19:30 +01:00 committed by Mergify
parent c6e7eec7cf
commit 81b6c4de9b
1 changed files with 5 additions and 1 deletions

View File

@ -1130,12 +1130,16 @@ await_condition(ConditionFun, Timeout) ->
await_condition_with_retries(_ConditionFun, 0) ->
ct:fail("Condition did not materialize in the expected period of time");
await_condition_with_retries(ConditionFun, RetriesLeft) ->
case ConditionFun() of
try ConditionFun() of
false ->
timer:sleep(50),
await_condition_with_retries(ConditionFun, RetriesLeft - 1);
true ->
ok
catch
_:_ ->
timer:sleep(50),
await_condition_with_retries(ConditionFun, RetriesLeft - 1)
end.
%% Pass in any EUnit test object. Example: