github.com/jwhonce/docker@v0.6.7-0.20190327063223-da823cf3a5a3/internal/test/daemon/ops.go (about) 1 package daemon 2 3 import "github.com/docker/docker/internal/test/environment" 4 5 // WithExperimental sets the daemon in experimental mode 6 func WithExperimental(d *Daemon) { 7 d.experimental = true 8 d.init = true 9 } 10 11 // WithInit sets the daemon init 12 func WithInit(d *Daemon) { 13 d.init = true 14 } 15 16 // WithDockerdBinary sets the dockerd binary to the specified one 17 func WithDockerdBinary(dockerdBinary string) func(*Daemon) { 18 return func(d *Daemon) { 19 d.dockerdBinary = dockerdBinary 20 } 21 } 22 23 // WithSwarmPort sets the swarm port to use for swarm mode 24 func WithSwarmPort(port int) func(*Daemon) { 25 return func(d *Daemon) { 26 d.SwarmPort = port 27 } 28 } 29 30 // WithSwarmListenAddr sets the swarm listen addr to use for swarm mode 31 func WithSwarmListenAddr(listenAddr string) func(*Daemon) { 32 return func(d *Daemon) { 33 d.swarmListenAddr = listenAddr 34 } 35 } 36 37 // WithSwarmDefaultAddrPool sets the swarm default address pool to use for swarm mode 38 func WithSwarmDefaultAddrPool(defaultAddrPool []string) func(*Daemon) { 39 return func(d *Daemon) { 40 d.DefaultAddrPool = defaultAddrPool 41 } 42 } 43 44 // WithSwarmDefaultAddrPoolSubnetSize sets the subnet length mask of swarm default address pool to use for swarm mode 45 func WithSwarmDefaultAddrPoolSubnetSize(subnetSize uint32) func(*Daemon) { 46 return func(d *Daemon) { 47 d.SubnetSize = subnetSize 48 } 49 } 50 51 // WithSwarmDataPathPort sets the swarm datapath port to use for swarm mode 52 func WithSwarmDataPathPort(datapathPort uint32) func(*Daemon) { 53 return func(d *Daemon) { 54 d.DataPathPort = datapathPort 55 } 56 } 57 58 // WithEnvironment sets options from internal/test/environment.Execution struct 59 func WithEnvironment(e environment.Execution) func(*Daemon) { 60 return func(d *Daemon) { 61 if e.DaemonInfo.ExperimentalBuild { 62 d.experimental = true 63 } 64 } 65 }