This parameter allows to set soft memory limit for Go GC. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
30 lines
736 B
Go
30 lines
736 B
Go
package runtime
|
|
|
|
import (
|
|
"math"
|
|
"testing"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
|
configtest "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config/test"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGCMemoryLimit(t *testing.T) {
|
|
t.Run("defaults", func(t *testing.T) {
|
|
empty := configtest.EmptyConfig()
|
|
|
|
require.Equal(t, int64(math.MaxInt64), GCMemoryLimitBytes(empty))
|
|
})
|
|
|
|
const path = "../../../../config/example/node"
|
|
|
|
fileConfigTest := func(c *config.Config) {
|
|
require.Equal(t, int64(1073741824), GCMemoryLimitBytes(c))
|
|
}
|
|
|
|
configtest.ForEachFileType(path, fileConfigTest)
|
|
|
|
t.Run("ENV", func(t *testing.T) {
|
|
configtest.ForEnvFileType(t, path, fileConfigTest)
|
|
})
|
|
}
|