1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/testutil/daemon/ops.go
Sam Whited b37c214e3c testutil: make testing packages public
This was done with something along the lines of:

```
mv internal/test testutil
pushd testutil/; grep -IRl "package test" | xargs -I '{}' sed -i -e 's|package test|package testutil|g' {}; popd
mv internal/testutil/*.go testutil/ && rm -rf internal/
grep -IRl "github.com\/docker\/docker\/internal\/test" | xargs -I '{}' sed -i -e 's|github.com/docker/docker/internal/test|github.com/docker/docker/test|g' {}
goimports .
```

I also modified the basic plugin path in testutil/fixtures/plugin.

Signed-off-by: Sam Whited <sam@samwhited.com>
2019-09-11 07:47:23 -05:00

79 lines
2.1 KiB
Go

package daemon
import "github.com/docker/docker/testutil/environment"
// WithDefaultCgroupNamespaceMode sets the default cgroup namespace mode for the daemon
func WithDefaultCgroupNamespaceMode(mode string) func(*Daemon) {
return func(d *Daemon) {
d.defaultCgroupNamespaceMode = mode
}
}
// WithExperimental sets the daemon in experimental mode
func WithExperimental(d *Daemon) {
d.experimental = true
d.init = true
}
// WithInit sets the daemon init
func WithInit(d *Daemon) {
d.init = true
}
// WithDockerdBinary sets the dockerd binary to the specified one
func WithDockerdBinary(dockerdBinary string) func(*Daemon) {
return func(d *Daemon) {
d.dockerdBinary = dockerdBinary
}
}
// WithSwarmPort sets the swarm port to use for swarm mode
func WithSwarmPort(port int) func(*Daemon) {
return func(d *Daemon) {
d.SwarmPort = port
}
}
// WithSwarmListenAddr sets the swarm listen addr to use for swarm mode
func WithSwarmListenAddr(listenAddr string) func(*Daemon) {
return func(d *Daemon) {
d.swarmListenAddr = listenAddr
}
}
// WithSwarmDefaultAddrPool sets the swarm default address pool to use for swarm mode
func WithSwarmDefaultAddrPool(defaultAddrPool []string) func(*Daemon) {
return func(d *Daemon) {
d.DefaultAddrPool = defaultAddrPool
}
}
// WithSwarmDefaultAddrPoolSubnetSize sets the subnet length mask of swarm default address pool to use for swarm mode
func WithSwarmDefaultAddrPoolSubnetSize(subnetSize uint32) func(*Daemon) {
return func(d *Daemon) {
d.SubnetSize = subnetSize
}
}
// WithSwarmDataPathPort sets the swarm datapath port to use for swarm mode
func WithSwarmDataPathPort(datapathPort uint32) func(*Daemon) {
return func(d *Daemon) {
d.DataPathPort = datapathPort
}
}
// WithEnvironment sets options from testutil/environment.Execution struct
func WithEnvironment(e environment.Execution) func(*Daemon) {
return func(d *Daemon) {
if e.DaemonInfo.ExperimentalBuild {
d.experimental = true
}
}
}
// WithStorageDriver sets store driver option
func WithStorageDriver(driver string) func(d *Daemon) {
return func(d *Daemon) {
d.storageDriver = driver
}
}