From be6898a51dd3c30c1f7d0fbc9bbf03891a19e866 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 21 May 2021 20:51:59 +0300 Subject: [PATCH] [#493] node/config/logger: Cover ENV variables with unit test Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config/logger/config_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmd/neofs-node/config/logger/config_test.go b/cmd/neofs-node/config/logger/config_test.go index 16a72c79e..6258bed9b 100644 --- a/cmd/neofs-node/config/logger/config_test.go +++ b/cmd/neofs-node/config/logger/config_test.go @@ -1,9 +1,11 @@ package loggerconfig_test import ( + "os" "testing" "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config" + "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/internal" loggerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/logger" configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test" "github.com/stretchr/testify/require" @@ -24,4 +26,17 @@ func TestLoggerSection_Level(t *testing.T) { empty := loggerconfig.Init(configtest.EmptyConfig()) checkLevel(empty, loggerconfig.LevelDefault) + + t.Run("ENV", func(t *testing.T) { + // TODO: read from file + err := os.Setenv( + internal.Env("logger", "level"), + "debug", + ) + require.NoError(t, err) + + empty = loggerconfig.Init(configtest.EmptyConfig()) + + checkLevel(empty, "debug") + }) }