Elixir 1.19: Improve DeprecationWarningsTest Logger reconfiguration test
This commit is contained in:
parent
0f262bb2f3
commit
02fc770e36
1 changed files with 12 additions and 11 deletions
|
|
@ -11,6 +11,8 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
|
||||||
alias Pleroma.Config
|
alias Pleroma.Config
|
||||||
alias Pleroma.Config.DeprecationWarnings
|
alias Pleroma.Config.DeprecationWarnings
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
|
||||||
describe "filter exiftool" do
|
describe "filter exiftool" do
|
||||||
test "gives warning when still used" do
|
test "gives warning when still used" do
|
||||||
clear_config(
|
clear_config(
|
||||||
|
|
@ -392,11 +394,12 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
|
||||||
describe "check_deprecated_logger_config" do
|
describe "check_deprecated_logger_config" do
|
||||||
setup do
|
setup do
|
||||||
Application.put_env(:logger, :backends, [:console, {ExSyslogger, :ex_syslogger}])
|
Application.put_env(:logger, :backends, [:console, {ExSyslogger, :ex_syslogger}])
|
||||||
Application.put_env(:logger, :console, level: :debug)
|
Application.put_env(:logger, :console, level: :info)
|
||||||
|
|
||||||
on_exit(fn ->
|
on_exit(fn ->
|
||||||
Application.delete_env(:logger, :backends)
|
Application.delete_env(:logger, :backends)
|
||||||
Application.delete_env(:logger, :console)
|
Application.delete_env(:logger, :console)
|
||||||
|
Logger.configure(level: :debug)
|
||||||
:logger.update_handler_config(:default, :formatter, Logger.default_formatter())
|
:logger.update_handler_config(:default, :formatter, Logger.default_formatter())
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
@ -435,20 +438,18 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "reconfigures logger" do
|
test "reconfigures logger" do
|
||||||
log =
|
empty_log =
|
||||||
capture_log(fn ->
|
capture_log(fn ->
|
||||||
Pleroma.Config.DeprecationWarnings.check_deprecated_logger_config()
|
Logger.debug("This should not be logged")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
# Formatter has inconsitent color formatting order
|
logged =
|
||||||
assert log =~
|
capture_log(fn ->
|
||||||
"""
|
Logger.info("This should be logged")
|
||||||
Reconfiguring console Logger with deprecated configuration syntax.
|
end)
|
||||||
Handler configuration:
|
|
||||||
[level: :debug]
|
|
||||||
|
|
||||||
Formatter:
|
assert empty_log =~ ""
|
||||||
"""
|
assert logged =~ "This should be logged"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue