2021-05-21 11:50:40 +00:00
|
|
|
package config_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
2021-05-21 13:46:15 +00:00
|
|
|
configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test"
|
2021-05-21 11:50:40 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestConfigCommon(t *testing.T) {
|
2021-05-21 13:46:15 +00:00
|
|
|
configtest.ForEachFileType("test/config", func(c *config.Config) {
|
2021-05-21 11:50:40 +00:00
|
|
|
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)
|
|
|
|
})
|
|
|
|
}
|