Просмотр исходного кода

Merge pull request #202 from basho/adt-buildbot-fixes

Make tests pass on buildbot more of the time
pull/205/head
Andrew Thompson 11 лет назад
Родитель
Сommit
0e2ed22292
6 измененных файлов: 19 добавлений и 4 удалений
  1. +2
    -0
      src/lager_console_backend.erl
  2. +1
    -0
      src/lager_crash_log.erl
  3. +3
    -1
      src/lager_file_backend.erl
  4. +2
    -0
      src/lager_handler_watcher.erl
  5. +1
    -0
      src/lager_util.erl
  6. +10
    -3
      test/lager_test_backend.erl

+ 2
- 0
src/lager_console_backend.erl Просмотреть файл

@ -175,6 +175,7 @@ console_log_test_() ->
unregister(user),
register(user, User),
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end,
[
@ -388,6 +389,7 @@ set_loglevel_test_() ->
end,
fun(_) ->
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end,
[

+ 1
- 0
src/lager_crash_log.erl Просмотреть файл

@ -253,6 +253,7 @@ filesystem_test_() ->
end,
file:delete("crash_test.log"),
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end,
[

+ 3
- 1
src/lager_file_backend.erl Просмотреть файл

@ -476,6 +476,7 @@ filesystem_test_() ->
file:delete("test.log.0"),
file:delete("test.log.1"),
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end,
[
@ -607,7 +608,7 @@ filesystem_test_() ->
?assertEqual({ok, <<>>}, file:read_file("test.log")),
lager:log(info, self(), "Test message1"),
?assertEqual({ok, <<>>}, file:read_file("test.log")),
timer:sleep(1000),
timer:sleep(2000),
{ok, Bin} = file:read_file("test.log"),
?assert(<<>> /= Bin)
end
@ -722,6 +723,7 @@ formatting_test_() ->
file:delete("test.log"),
file:delete("test2.log"),
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end,
[{"Should have two log files, the second prefixed with 2>",

+ 2
- 0
src/lager_handler_watcher.erl Просмотреть файл

@ -134,6 +134,7 @@ reinstall_on_initial_failure_test_() ->
?assert(lists:member(lager_crash_backend, gen_event:which_handlers(lager_event)))
after
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end
end
@ -162,6 +163,7 @@ reinstall_on_runtime_failure_test_() ->
?assertEqual(false, lists:member(lager_crash_backend, gen_event:which_handlers(lager_event)))
after
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end
end

+ 1
- 0
src/lager_util.erl Просмотреть файл

@ -629,6 +629,7 @@ check_trace_test() ->
{[{module, '*'}], config_to_mask('!=notice'), anythingbutnotice}
], [])),
application:stop(lager),
application:stop(goldrush),
ok.
is_loggable_test_() ->

+ 10
- 3
test/lager_test_backend.erl Просмотреть файл

@ -511,7 +511,7 @@ lager_test_() ->
{"record printing fails gracefully when module is invalid",
fun() ->
spawn(fun() -> lager:info("State ~p", [lager:pr({state, 1}, not_a_module)]) end),
timer:sleep(100),
timer:sleep(1000),
{Level, _Time, Message, _Metadata} = pop(),
?assertMatch(Level, lager_util:level_to_num(info)),
?assertEqual("State {state,1}", lists:flatten(Message)),
@ -566,6 +566,7 @@ setup() ->
cleanup(_) ->
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true).
@ -620,6 +621,7 @@ error_logger_redirect_crash_test_() ->
fun(_) ->
application:stop(lager),
application:stop(goldrush),
case whereis(crash) of
undefined -> ok;
Pid -> exit(Pid, kill)
@ -669,6 +671,7 @@ error_logger_redirect_test_() ->
fun(_) ->
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end,
[
@ -1158,13 +1161,15 @@ async_threshold_test_() ->
error_logger:tty(false),
application:load(lager),
application:set_env(lager, error_logger_redirect, false),
application:set_env(lager, async_threshold, 10),
application:set_env(lager, async_threshold, 2),
application:set_env(lager, async_threshold_window, 1),
application:set_env(lager, handlers, [{?MODULE, info}]),
lager:start()
end,
fun(_) ->
application:unset_env(lager, async_threshold),
application:stop(lager),
application:stop(goldrush),
error_logger:tty(true)
end,
[
@ -1186,7 +1191,9 @@ async_threshold_test_() ->
%% serialize ont the mailbox again
_ = gen_event:which_handlers(lager_event),
%% just in case...
timer:sleep(100),
timer:sleep(1000),
lager:info("hello world"),
_ = gen_event:which_handlers(lager_event),
%% async is true again now that the mailbox has drained
?assertEqual(true, lager_config:get(async)),

Загрузка…
Отмена
Сохранить