test: drop custom `loop_wait` in favor of snabkaffe's `?retry`

This commit is contained in:
Andrew Mayorov 2023-02-24 18:16:35 +03:00
parent 2b4e49e7df
commit c883e4b36a
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 20 additions and 29 deletions

View File

@ -1539,7 +1539,10 @@ t_async_reply_multi_eval(_Config) ->
end, end,
#{} #{}
), ),
F = fun() -> ?retry(
ResumeInterval,
TotalTime div ResumeInterval,
begin
Metrics = tap_metrics(?LINE), Metrics = tap_metrics(?LINE),
#{ #{
counters := Counters, counters := Counters,
@ -1554,8 +1557,8 @@ t_async_reply_multi_eval(_Config) ->
} = Counters, } = Counters,
?assertEqual(TotalQueries, Matched - 1), ?assertEqual(TotalQueries, Matched - 1),
?assertEqual(Matched, Success + Dropped + LateReply + Failed) ?assertEqual(Matched, Success + Dropped + LateReply + Failed)
end, end
loop_wait(F, _Interval = 5, TotalTime). ).
t_retry_async_inflight_batch(_Config) -> t_retry_async_inflight_batch(_Config) ->
ResumeInterval = 1_000, ResumeInterval = 1_000,
@ -2622,15 +2625,3 @@ assert_async_retry_fail_then_succeed_inflight(Trace) ->
) )
), ),
ok. ok.
loop_wait(F, Interval, TotalTime) when Interval >= TotalTime ->
%% do it for the last time
F();
loop_wait(F, Interval, TotalTime) ->
try
F()
catch
_:_ ->
timer:sleep(Interval),
loop_wait(F, Interval, TotalTime - Interval)
end.