frostfs-node/cmd/neofs-node/config/tree/config_test.go
Pavel Karpy 8162b27264 [#1627] node: Add tree service to the config framework
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-07-27 12:15:56 +03:00

40 lines
1.1 KiB
Go

package treeconfig_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"
treeconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/tree"
"github.com/stretchr/testify/require"
)
func TestTreeSection(t *testing.T) {
t.Run("defaults", func(t *testing.T) {
empty := configtest.EmptyConfig()
treeSec := treeconfig.Tree(empty)
require.False(t, treeSec.Enabled())
require.Equal(t, 0, treeSec.CacheSize())
require.Equal(t, 0, treeSec.ReplicationChannelCapacity())
require.Equal(t, 0, treeSec.ReplicationWorkerCount())
})
const path = "../../../../config/example/node"
var fileConfigTest = func(c *config.Config) {
treeSec := treeconfig.Tree(c)
require.True(t, treeSec.Enabled())
require.Equal(t, 15, treeSec.CacheSize())
require.Equal(t, 32, treeSec.ReplicationChannelCapacity())
require.Equal(t, 32, treeSec.ReplicationWorkerCount())
}
configtest.ForEachFileType(path, fileConfigTest)
t.Run("ENV", func(t *testing.T) {
configtest.ForEnvFileType(path, fileConfigTest)
})
}