mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #40013 from thaJeztah/fix_daemon_ops_type
testutil: change some remaining options to be a daemon.Option
This commit is contained in:
commit
b93f68ab4c
7 changed files with 19 additions and 15 deletions
|
@ -26,7 +26,7 @@ func TestBuildSquashParent(t *testing.T) {
|
|||
if !testEnv.DaemonInfo.ExperimentalBuild {
|
||||
skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
|
||||
|
||||
d := daemon.New(t, daemon.WithExperimental)
|
||||
d := daemon.New(t, daemon.WithExperimental())
|
||||
d.StartWithBusybox(t)
|
||||
defer d.Stop(t)
|
||||
client = d.NewClientT(t)
|
||||
|
|
|
@ -54,7 +54,7 @@ func NewSwarm(t *testing.T, testEnv *environment.Execution, ops ...daemon.Option
|
|||
skip.If(t, testEnv.IsRemoteDaemon)
|
||||
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
|
||||
if testEnv.DaemonInfo.ExperimentalBuild {
|
||||
ops = append(ops, daemon.WithExperimental)
|
||||
ops = append(ops, daemon.WithExperimental())
|
||||
}
|
||||
d := daemon.New(t, ops...)
|
||||
d.StartAndSwarmInit(t)
|
||||
|
|
|
@ -51,7 +51,7 @@ func setupTest(t *testing.T) func() {
|
|||
skip.If(t, testEnv.DaemonInfo.OSType == "windows")
|
||||
environment.ProtectAll(t, testEnv)
|
||||
|
||||
d = daemon.New(t, daemon.WithExperimental)
|
||||
d = daemon.New(t, daemon.WithExperimental())
|
||||
|
||||
return func() {
|
||||
if d != nil {
|
||||
|
|
|
@ -54,7 +54,7 @@ func TestExternalGraphDriver(t *testing.T) {
|
|||
sserver := setupPluginViaSpecFile(t, ec)
|
||||
jserver := setupPluginViaJSONFile(t, ec)
|
||||
// Create daemon
|
||||
d := daemon.New(t, daemon.WithExperimental)
|
||||
d := daemon.New(t, daemon.WithExperimental())
|
||||
c := d.NewClientT(t)
|
||||
|
||||
for _, tc := range []struct {
|
||||
|
@ -410,7 +410,7 @@ func TestGraphdriverPluginV2(t *testing.T) {
|
|||
skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
|
||||
skip.If(t, !requirement.Overlay2Supported(testEnv.DaemonInfo.KernelVersion))
|
||||
|
||||
d := daemon.New(t, daemon.WithExperimental)
|
||||
d := daemon.New(t, daemon.WithExperimental())
|
||||
d.Start(t)
|
||||
defer d.Stop(t)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ func testServiceCreateInit(daemonEnabled bool) func(t *testing.T) {
|
|||
var ops = []daemon.Option{}
|
||||
|
||||
if daemonEnabled {
|
||||
ops = append(ops, daemon.WithInit)
|
||||
ops = append(ops, daemon.WithInit())
|
||||
}
|
||||
d := swarm.NewSwarm(t, testEnv, ops...)
|
||||
defer d.Stop(t)
|
||||
|
|
|
@ -56,12 +56,12 @@ func TestServicePlugin(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
d.Stop(t)
|
||||
|
||||
d1 := swarm.NewSwarm(t, testEnv, daemon.WithExperimental)
|
||||
d1 := swarm.NewSwarm(t, testEnv, daemon.WithExperimental())
|
||||
defer d1.Stop(t)
|
||||
d2 := daemon.New(t, daemon.WithExperimental, daemon.WithSwarmPort(daemon.DefaultSwarmPort+1))
|
||||
d2 := daemon.New(t, daemon.WithExperimental(), daemon.WithSwarmPort(daemon.DefaultSwarmPort+1))
|
||||
d2.StartAndSwarmJoin(t, d1, true)
|
||||
defer d2.Stop(t)
|
||||
d3 := daemon.New(t, daemon.WithExperimental, daemon.WithSwarmPort(daemon.DefaultSwarmPort+2))
|
||||
d3 := daemon.New(t, daemon.WithExperimental(), daemon.WithSwarmPort(daemon.DefaultSwarmPort+2))
|
||||
d3.StartAndSwarmJoin(t, d1, false)
|
||||
defer d3.Stop(t)
|
||||
|
||||
|
|
|
@ -17,21 +17,25 @@ func WithDefaultCgroupNamespaceMode(mode string) Option {
|
|||
}
|
||||
|
||||
// WithTestLogger causes the daemon to log certain actions to the provided test.
|
||||
func WithTestLogger(t testing.TB) func(*Daemon) {
|
||||
func WithTestLogger(t testing.TB) Option {
|
||||
return func(d *Daemon) {
|
||||
d.log = t
|
||||
}
|
||||
}
|
||||
|
||||
// WithExperimental sets the daemon in experimental mode
|
||||
func WithExperimental(d *Daemon) {
|
||||
func WithExperimental() Option {
|
||||
return func(d *Daemon) {
|
||||
d.experimental = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithInit sets the daemon init
|
||||
func WithInit(d *Daemon) {
|
||||
func WithInit() Option {
|
||||
return func(d *Daemon) {
|
||||
d.init = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithDockerdBinary sets the dockerd binary to the specified one
|
||||
func WithDockerdBinary(dockerdBinary string) Option {
|
||||
|
@ -85,7 +89,7 @@ func WithEnvironment(e environment.Execution) Option {
|
|||
}
|
||||
|
||||
// WithStorageDriver sets store driver option
|
||||
func WithStorageDriver(driver string) func(d *Daemon) {
|
||||
func WithStorageDriver(driver string) Option {
|
||||
return func(d *Daemon) {
|
||||
d.storageDriver = driver
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue