forked from TrueCloudLab/frostfs-node
[#493] node/config: Cover ENV variables with unit test
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
099ceeae50
commit
3fd4b32a4f
1 changed files with 17 additions and 0 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue