1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/cmd/dockerd/config_unix_test.go
Vincent Demeester db63f9370e
Extract daemon configuration and discovery to their own package
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>
2017-02-08 09:53:38 +01:00

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())
}
}