test: drop custom `loop_wait` in favor of snabkaffe's `?retry`
This commit is contained in:
parent
2b4e49e7df
commit
c883e4b36a
|
@ -1539,23 +1539,26 @@ t_async_reply_multi_eval(_Config) ->
|
||||||
end,
|
end,
|
||||||
#{}
|
#{}
|
||||||
),
|
),
|
||||||
F = fun() ->
|
?retry(
|
||||||
Metrics = tap_metrics(?LINE),
|
ResumeInterval,
|
||||||
#{
|
TotalTime div ResumeInterval,
|
||||||
counters := Counters,
|
begin
|
||||||
gauges := #{queuing := 0, inflight := 0}
|
Metrics = tap_metrics(?LINE),
|
||||||
} = Metrics,
|
#{
|
||||||
#{
|
counters := Counters,
|
||||||
matched := Matched,
|
gauges := #{queuing := 0, inflight := 0}
|
||||||
success := Success,
|
} = Metrics,
|
||||||
dropped := Dropped,
|
#{
|
||||||
late_reply := LateReply,
|
matched := Matched,
|
||||||
failed := Failed
|
success := Success,
|
||||||
} = Counters,
|
dropped := Dropped,
|
||||||
?assertEqual(TotalQueries, Matched - 1),
|
late_reply := LateReply,
|
||||||
?assertEqual(Matched, Success + Dropped + LateReply + Failed)
|
failed := Failed
|
||||||
end,
|
} = Counters,
|
||||||
loop_wait(F, _Interval = 5, TotalTime).
|
?assertEqual(TotalQueries, Matched - 1),
|
||||||
|
?assertEqual(Matched, Success + Dropped + LateReply + Failed)
|
||||||
|
end
|
||||||
|
).
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
Loading…
Reference in New Issue