瀏覽代碼

Put the warning map value into process dictionary

The sync_error_logger file looks up the value to send from a process
dictionary entry named `warning_map' When it is unset, it uses a mapping
which is fine for OTP 17 and before, but 18 and 19 the value changed.

So now we put the current mapping value into the process dictionary so
that the messages do not cause failed tests.
pull/337/head
Mark Allen 9 年之前
父節點
當前提交
53b5eb808b
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. +8
    -4
      test/lager_test_backend.erl

+ 8
- 4
test/lager_test_backend.erl 查看文件

@ -1128,8 +1128,9 @@ error_logger_redirect_test_() ->
},
{"warning messages with unicode characters in Args are printed",
fun(Sink) ->
sync_error_logger:warning_msg("~ts", ["Привет!"]),
Map = error_logger:warning_map(),
put(warning_map, Map),
sync_error_logger:warning_msg("~ts", ["Привет!"]),
_ = gen_event:which_handlers(error_logger),
{Level, _, Msg,Metadata} = pop(Sink),
?assertEqual(lager_util:level_to_num(Map),Level),
@ -1140,8 +1141,9 @@ error_logger_redirect_test_() ->
{"warning messages are printed at the correct level",
fun(Sink) ->
sync_error_logger:warning_msg("doom, doom has come upon you all"),
Map = error_logger:warning_map(),
put(warning_map, Map),
sync_error_logger:warning_msg("doom, doom has come upon you all"),
_ = gen_event:which_handlers(error_logger),
{Level, _, Msg,Metadata} = pop(Sink),
?assertEqual(lager_util:level_to_num(Map),Level),
@ -1151,8 +1153,9 @@ error_logger_redirect_test_() ->
},
{"warning reports are printed at the correct level",
fun(Sink) ->
sync_error_logger:warning_report([{i, like}, pie]),
Map = error_logger:warning_map(),
put(warning_map, Map),
sync_error_logger:warning_report([{i, like}, pie]),
_ = gen_event:which_handlers(error_logger),
{Level, _, Msg,Metadata} = pop(Sink),
?assertEqual(lager_util:level_to_num(Map),Level),
@ -1162,8 +1165,9 @@ error_logger_redirect_test_() ->
},
{"single term warning reports are printed at the correct level",
fun(Sink) ->
sync_error_logger:warning_report({foolish, bees}),
Map = error_logger:warning_map(),
put(warning_map, Map),
sync_error_logger:warning_report({foolish, bees}),
_ = gen_event:which_handlers(error_logger),
{Level, _, Msg,Metadata} = pop(Sink),
?assertEqual(lager_util:level_to_num(Map),Level),

Loading…
取消
儲存