From e5c014bbfbeacfc2c0638545e2bbb4bc758befd7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 21 May 2021 16:47:45 +0300 Subject: [PATCH] [#493] node/config/logger: Write unit tests Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config/logger/config_test.go | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cmd/neofs-node/config/logger/config_test.go diff --git a/cmd/neofs-node/config/logger/config_test.go b/cmd/neofs-node/config/logger/config_test.go new file mode 100644 index 000000000..16a72c79e --- /dev/null +++ b/cmd/neofs-node/config/logger/config_test.go @@ -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) +}