2021-06-02 12:26:51 +00:00
|
|
|
package replicatorconfig_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
|
|
|
replicatorconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/replicator"
|
|
|
|
configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestReplicatorSection(t *testing.T) {
|
|
|
|
t.Run("defaults", func(t *testing.T) {
|
|
|
|
empty := configtest.EmptyConfig()
|
|
|
|
|
|
|
|
require.Equal(t, replicatorconfig.PutTimeoutDefault, replicatorconfig.PutTimeout(empty))
|
2022-11-12 12:23:33 +00:00
|
|
|
require.Equal(t, 0, replicatorconfig.PoolSize(empty))
|
2021-06-02 12:26:51 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
const path = "../../../../config/example/node"
|
|
|
|
|
|
|
|
var fileConfigTest = func(c *config.Config) {
|
|
|
|
require.Equal(t, 15*time.Second, replicatorconfig.PutTimeout(c))
|
2022-11-12 12:23:33 +00:00
|
|
|
require.Equal(t, 10, replicatorconfig.PoolSize(c))
|
2021-06-02 12:26:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
configtest.ForEachFileType(path, fileConfigTest)
|
|
|
|
|
|
|
|
t.Run("ENV", func(t *testing.T) {
|
|
|
|
configtest.ForEnvFileType(path, fileConfigTest)
|
|
|
|
})
|
|
|
|
}
|