forked from TrueCloudLab/frostfs-node
24 lines
645 B
Go
24 lines
645 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"path"
|
|
"testing"
|
|
|
|
"github.com/spf13/cast"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestConfigDir(t *testing.T) {
|
|
dir := t.TempDir()
|
|
|
|
cfgFileName0 := path.Join(dir, "cfg_00.json")
|
|
cfgFileName1 := path.Join(dir, "cfg_01.yml")
|
|
|
|
require.NoError(t, os.WriteFile(cfgFileName0, []byte(`{"storage":{"shard_pool_size":15}}`), 0o777))
|
|
require.NoError(t, os.WriteFile(cfgFileName1, []byte("logger:\n level: debug"), 0o777))
|
|
|
|
c := New("", dir, "")
|
|
require.Equal(t, "debug", cast.ToString(c.Sub("logger").Value("level")))
|
|
require.EqualValues(t, 15, cast.ToUint32(c.Sub("storage").Value("shard_pool_size")))
|
|
}
|