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:
Kirill Kolyshkin 2019-09-30 12:23:15 -07:00 committed by GitHub
commit b93f68ab4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 15 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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 {

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -17,20 +17,24 @@ 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) {
d.experimental = true
func WithExperimental() Option {
return func(d *Daemon) {
d.experimental = true
}
}
// WithInit sets the daemon init
func WithInit(d *Daemon) {
d.init = true
func WithInit() Option {
return func(d *Daemon) {
d.init = true
}
}
// WithDockerdBinary sets the dockerd binary to the specified one
@ -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
}