36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package objectconfig_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
|
objectconfig "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/object"
|
|
configtest "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/test"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestObjectSection(t *testing.T) {
|
|
t.Run("defaults", func(t *testing.T) {
|
|
empty := configtest.EmptyConfig()
|
|
|
|
require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeRemote())
|
|
require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeLocal())
|
|
require.EqualValues(t, objectconfig.DefaultTombstoneLifetime, objectconfig.TombstoneLifetime(empty))
|
|
require.False(t, objectconfig.Put(empty).SkipSessionTokenIssuerVerification())
|
|
})
|
|
|
|
const path = "../../../../config/example/node"
|
|
|
|
fileConfigTest := func(c *config.Config) {
|
|
require.Equal(t, 100, objectconfig.Put(c).PoolSizeRemote())
|
|
require.Equal(t, 200, objectconfig.Put(c).PoolSizeLocal())
|
|
require.EqualValues(t, 10, objectconfig.TombstoneLifetime(c))
|
|
require.True(t, objectconfig.Put(c).SkipSessionTokenIssuerVerification())
|
|
}
|
|
|
|
configtest.ForEachFileType(path, fileConfigTest)
|
|
|
|
t.Run("ENV", func(t *testing.T) {
|
|
configtest.ForEnvFileType(t, path, fileConfigTest)
|
|
})
|
|
}
|