From 3fd4b32a4fc1b9b63dfb834e29e3115e79fa677c Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 21 May 2021 20:43:00 +0300 Subject: [PATCH] [#493] node/config: Cover ENV variables with unit test Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config/calls_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmd/neofs-node/config/calls_test.go b/cmd/neofs-node/config/calls_test.go index e6da971b0..6408447c2 100644 --- a/cmd/neofs-node/config/calls_test.go +++ b/cmd/neofs-node/config/calls_test.go @@ -1,9 +1,11 @@ package config_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" configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test" "github.com/stretchr/testify/require" ) @@ -25,3 +27,18 @@ func TestConfigCommon(t *testing.T) { require.Nil(t, val) }) } + +func TestConfigEnv(t *testing.T) { + const ( + name = "name" + section = "section" + value = "some value" + ) + + err := os.Setenv(internal.Env(section, name), value) + require.NoError(t, err) + + c := configtest.EmptyConfig() + + require.Equal(t, value, c.Sub(section).Value(name)) +}