forked from TrueCloudLab/frostfs-node
[#493] node/config/logger: Write unit tests
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f833fe1ee2
commit
e5c014bbfb
1 changed files with 27 additions and 0 deletions
27
cmd/neofs-node/config/logger/config_test.go
Normal file
27
cmd/neofs-node/config/logger/config_test.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
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) {
|
||||
checkLevel := func(c *loggerconfig.LoggerSection, expected string) {
|
||||
lvl := c.Level()
|
||||
require.Equal(t, expected, lvl)
|
||||
}
|
||||
|
||||
configtest.ForEachFileType("../../../../config/example/node", func(c *config.Config) {
|
||||
cfg := loggerconfig.Init(c)
|
||||
|
||||
checkLevel(cfg, "debug")
|
||||
})
|
||||
|
||||
empty := loggerconfig.Init(configtest.EmptyConfig())
|
||||
|
||||
checkLevel(empty, loggerconfig.LevelDefault)
|
||||
}
|
Loading…
Reference in a new issue