浏览代码

Only sleep for a long time when CI env variable is present, like on Travis CI

pull/509/head
Luke Bakken 5 年前
父节点
当前提交
aa09a2cd9c
找不到此签名对应的密钥 GPG 密钥 ID: D99DE30E43EAE440
共有 1 个文件被更改,包括 13 次插入3 次删除
  1. +13
    -3
      test/lager_test_backend.erl

+ 13
- 3
test/lager_test_backend.erl 查看文件

@ -1776,6 +1776,8 @@ async_threshold_test_() ->
{foreach, Setup, Cleanup, [
{"async threshold works",
{timeout, 30, fun() ->
Sleep = get_long_sleep_value(),
%% we start out async
?assertEqual(true, lager_config:get(async)),
?assertEqual([{sync_toggled, 0}],
@ -1790,7 +1792,7 @@ async_threshold_test_() ->
%% serialize on mailbox
_ = gen_event:which_handlers(lager_event),
timer:sleep(5000),
timer:sleep(Sleep),
%% By now the flood of messages should have forced the backend throttle
%% to turn off async mode, but it's possible all outstanding requests
@ -1807,12 +1809,12 @@ async_threshold_test_() ->
%% serialize on the mailbox again
_ = gen_event:which_handlers(lager_event),
timer:sleep(5000),
timer:sleep(Sleep),
lager:info("hello world"),
_ = gen_event:which_handlers(lager_event),
timer:sleep(5000),
timer:sleep(Sleep),
%% async is true again now that the mailbox has drained
?assertEqual(true, lager_config:get(async)),
@ -1904,4 +1906,12 @@ high_watermark_test_() ->
]
}.
get_long_sleep_value() ->
case os:getenv("CI") of
false ->
500;
_ ->
5000
end.
-endif.

正在加载...
取消
保存