mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
db63f9370e
This also moves some cli specific in `cmd/dockerd` as it does not really belong to the `daemon/config` package. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
32 lines
907 B
Go
32 lines
907 B
Go
// +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())
|
|
}
|
|
}
|