[#493] node/config/logger: Cover ENV variables with unit test

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-21 20:51:59 +03:00 committed by Leonard Lyubich
parent 3fd4b32a4f
commit be6898a51d

View file

@ -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")
})
}