[#493] node/config: Cover ENV variables with unit test

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-21 20:43:00 +03:00 committed by Leonard Lyubich
parent 099ceeae50
commit 3fd4b32a4f

View file

@ -1,9 +1,11 @@
package config_test package config_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"
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"
) )
@ -25,3 +27,18 @@ func TestConfigCommon(t *testing.T) {
require.Nil(t, val) 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))
}