forked from TrueCloudLab/frostfs-node
[#493] node/config/logger: Cover ENV variables with unit test
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3fd4b32a4f
commit
be6898a51d
1 changed files with 15 additions and 0 deletions
|
@ -1,9 +1,11 @@
|
||||||
package loggerconfig_test
|
package loggerconfig_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
"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"
|
loggerconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/logger"
|
||||||
configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test"
|
configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -24,4 +26,17 @@ func TestLoggerSection_Level(t *testing.T) {
|
||||||
empty := loggerconfig.Init(configtest.EmptyConfig())
|
empty := loggerconfig.Init(configtest.EmptyConfig())
|
||||||
|
|
||||||
checkLevel(empty, loggerconfig.LevelDefault)
|
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")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue