blob: 595b07263bdd19a900a124ad5d08ca14ad6fd7d2 [file] [log] [blame]
// +build linux,!solaris freebsd,!solaris
package main
import (
"runtime"
"testing"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/pkg/testutil/assert"
"github.com/spf13/pflag"
)
func TestDaemonParseShmSize(t *testing.T) {
if runtime.GOOS == "solaris" {
t.Skip("ShmSize not supported on Solaris\n")
}
flags := pflag.NewFlagSet("test", pflag.ContinueOnError)
conf := &config.Config{}
installConfigFlags(conf, flags)
// By default `--default-shm-size=64M`
expectedValue := 64 * 1024 * 1024
if conf.ShmSize.Value() != int64(expectedValue) {
t.Fatalf("expected default shm size %d, got %d", expectedValue, conf.ShmSize.Value())
}
assert.NilError(t, flags.Set("default-shm-size", "128M"))
expectedValue = 128 * 1024 * 1024
if conf.ShmSize.Value() != int64(expectedValue) {
t.Fatalf("expected default shm size %d, got %d", expectedValue, conf.ShmSize.Value())
}
}