Concurrent Apply can lead to child node applies before parent, so undo/redo operations will perform. This leads to performance degradation in case of tree with many sublevels. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
56 lines
1.9 KiB
Go
56 lines
1.9 KiB
Go
package treeconfig_test
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
|
configtest "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/test"
|
|
treeconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/tree"
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
"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())
|
|
require.Equal(t, time.Duration(0), treeSec.ReplicationTimeout())
|
|
require.Equal(t, 0, len(treeSec.AuthorizedKeys()))
|
|
})
|
|
|
|
const path = "../../../../config/example/node"
|
|
|
|
var expectedKeys keys.PublicKeys
|
|
key, err := keys.NewPublicKeyFromString("0397d207ea77909f7d66fa6f36d08daae22ace672be7ea4f53513484dde8a142a0")
|
|
require.NoError(t, err)
|
|
expectedKeys = append(expectedKeys, key)
|
|
key, err = keys.NewPublicKeyFromString("02053819235c20d784132deba10bb3061629e3a5c819a039ef091841d9d35dad56")
|
|
require.NoError(t, err)
|
|
expectedKeys = append(expectedKeys, key)
|
|
|
|
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())
|
|
require.Equal(t, 5*time.Second, treeSec.ReplicationTimeout())
|
|
require.Equal(t, time.Hour, treeSec.SyncInterval())
|
|
require.Equal(t, 2000, treeSec.SyncBatchSize())
|
|
require.Equal(t, expectedKeys, treeSec.AuthorizedKeys())
|
|
}
|
|
|
|
configtest.ForEachFileType(path, fileConfigTest)
|
|
|
|
t.Run("ENV", func(t *testing.T) {
|
|
configtest.ForEnvFileType(t, path, fileConfigTest)
|
|
})
|
|
}
|