frostfs-node/cmd/neofs-node/config/calls_test.go
Leonard Lyubich b8a5f09174 [#493] node/config: Export useful functions into a separate test package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-01 11:45:38 +03:00

30 lines
664 B
Go

package config_test
import (
"testing"
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test"
"github.com/stretchr/testify/require"
)
func TestConfigCommon(t *testing.T) {
configtest.ForEachFileType("test/config", func(c *config.Config) {
val := c.Value("value")
require.NotNil(t, val)
val = c.Value("non-existent value")
require.Nil(t, val)
sub := c.Sub("section")
require.NotNil(t, sub)
const nonExistentSub = "non-existent sub-section"
sub = c.Sub(nonExistentSub)
require.Nil(t, sub)
val = c.Sub(nonExistentSub).Value("value")
require.Nil(t, val)
})
}