Reduce false-positive test failures by increasing timeouts

This commit is contained in:
Daniil Fedotov 2018-06-04 11:14:03 +04:00
parent 50861db2b1
commit e03a97a0e6
1 changed files with 5 additions and 4 deletions

View File

@ -153,7 +153,7 @@ random_timing(Config) ->
random_timing(Config, MaxTTL, Parallel) -> random_timing(Config, MaxTTL, Parallel) ->
AuthCacheModule = ?config(auth_cache_module, Config), AuthCacheModule = ?config(auth_cache_module, Config),
RandomTTls = [{N, rabbit_misc:random(MaxTTL) + 100} || N <- lists:seq(1, Parallel)], RandomTTls = [{N, rabbit_misc:random(MaxTTL) + 200} || N <- lists:seq(1, Parallel)],
Pid = self(), Pid = self(),
Ref = make_ref(), Ref = make_ref(),
Pids = lists:map( Pids = lists:map(
@ -163,6 +163,7 @@ random_timing(Config, MaxTTL, Parallel) ->
Key = N, Key = N,
Value = {tuple_with, N, TTL}, Value = {tuple_with, N, TTL},
{error, not_found} = AuthCacheModule:get(Key), {error, not_found} = AuthCacheModule:get(Key),
PutTime = erlang:system_time(milli_seconds),
ok = AuthCacheModule:put(Key, Value, TTL), ok = AuthCacheModule:put(Key, Value, TTL),
case AuthCacheModule:get(Key) of case AuthCacheModule:get(Key) of
{ok, Value} -> ok; {ok, Value} -> ok;
@ -175,13 +176,13 @@ random_timing(Config, MaxTTL, Parallel) ->
[ets:tab2list(Segment) || {_, Segment} <- Segments]; [ets:tab2list(Segment) || {_, Segment} <- Segments];
_ -> [] _ -> []
end, end,
error({Other, Value, State, Data}); error({Other, Value, PutTime, erlang:system_time(milli_seconds), State, Data});
_ -> _ ->
error({Other, Value}) error({Other, Value, PutTime, erlang:system_time(milli_seconds)})
end end
end, end,
% expiry error % expiry error
timer:sleep(TTL + 40), timer:sleep(TTL + 50),
{error, not_found} = AuthCacheModule:get(Key), {error, not_found} = AuthCacheModule:get(Key),
Pid ! {ok, self(), Ref} Pid ! {ok, self(), Ref}
end) end)