github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/cmd/dockerd/config_unix_test.go (about)

     1  // +build linux freebsd
     2  
     3  package main
     4  
     5  import (
     6  	"testing"
     7  
     8  	"github.com/demonoid81/moby/daemon/config"
     9  	"github.com/spf13/pflag"
    10  	"gotest.tools/v3/assert"
    11  	is "gotest.tools/v3/assert/cmp"
    12  )
    13  
    14  func TestDaemonParseShmSize(t *testing.T) {
    15  	flags := pflag.NewFlagSet("test", pflag.ContinueOnError)
    16  
    17  	conf := &config.Config{}
    18  	err := installConfigFlags(conf, flags)
    19  	assert.NilError(t, err)
    20  	// By default `--default-shm-size=64M`
    21  	assert.Check(t, is.Equal(int64(64*1024*1024), conf.ShmSize.Value()))
    22  	assert.Check(t, flags.Set("default-shm-size", "128M"))
    23  	assert.Check(t, is.Equal(int64(128*1024*1024), conf.ShmSize.Value()))
    24  }