summaryrefslogtreecommitdiff
path: root/cmd/dockerd/config_unix_test.go
diff options
context:
space:
mode:
authorVincent Demeester <vincent@sbr.pm>2017-01-23 12:23:07 +0100
committerVincent Demeester <vincent@sbr.pm>2017-02-08 09:53:38 +0100
commitdb63f9370e26d725357c703cbaf9ab63cc7b6d0a (patch)
tree1bbae3d140115d991d1f328be36e32950bc2e1c0 /cmd/dockerd/config_unix_test.go
parent41650df87e55c0d018c66d0d221920f87c343391 (diff)
downloaddocker-db63f9370e26d725357c703cbaf9ab63cc7b6d0a.tar.gz
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>
Diffstat (limited to 'cmd/dockerd/config_unix_test.go')
-rw-r--r--cmd/dockerd/config_unix_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/cmd/dockerd/config_unix_test.go b/cmd/dockerd/config_unix_test.go
new file mode 100644
index 0000000000..595b07263b
--- /dev/null
+++ b/cmd/dockerd/config_unix_test.go
@@ -0,0 +1,32 @@
+// +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())
+ }
+}