2021-05-21 13:47:45 +00:00
|
|
|
package loggerconfig_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
|
|
|
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"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestLoggerSection_Level(t *testing.T) {
|
2021-06-01 09:47:01 +00:00
|
|
|
t.Run("defaults", func(t *testing.T) {
|
|
|
|
v := loggerconfig.Level(configtest.EmptyConfig())
|
|
|
|
require.Equal(t, loggerconfig.LevelDefault, v)
|
|
|
|
})
|
|
|
|
|
|
|
|
const path = "../../../../config/example/node"
|
|
|
|
|
|
|
|
var fileConfigTest = func(c *config.Config) {
|
2021-05-21 18:03:47 +00:00
|
|
|
v := loggerconfig.Level(c)
|
|
|
|
require.Equal(t, "debug", v)
|
2021-06-01 09:47:01 +00:00
|
|
|
}
|
2021-05-21 13:47:45 +00:00
|
|
|
|
2021-06-01 09:47:01 +00:00
|
|
|
configtest.ForEachFileType(path, fileConfigTest)
|
2021-05-21 17:51:59 +00:00
|
|
|
|
|
|
|
t.Run("ENV", func(t *testing.T) {
|
2021-06-01 09:47:01 +00:00
|
|
|
configtest.ForEnvFileType(path, fileConfigTest)
|
2021-05-21 17:51:59 +00:00
|
|
|
})
|
2021-05-21 13:47:45 +00:00
|
|
|
}
|