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

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/release/v0.21.1
Leonard Lyubich 2021-05-21 20:43:00 +03:00 committed by Leonard Lyubich
parent 099ceeae50
commit 3fd4b32a4f
1 changed files with 17 additions and 0 deletions

View File

@ -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))
}