Sfoglia il codice sorgente

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 anni fa
parent
commit
53b5eb808b
1 ha cambiato i file con 8 aggiunte e 4 eliminazioni
  1. +8
    -4
      test/lager_test_backend.erl

+ 8
- 4
test/lager_test_backend.erl Vedi File

@ -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),

Caricamento…
Annulla
Salva