mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
33 lines
907 B
Go
33 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())
|
||
|
}
|
||
|
}
|