diff --git a/integration/build/build_session_test.go b/integration/build/build_session_test.go index ff04b63d8f..3abac981e5 100644 --- a/integration/build/build_session_test.go +++ b/integration/build/build_session_test.go @@ -8,23 +8,20 @@ import ( "testing" dclient "github.com/docker/docker/client" - "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/internal/test/request" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" + "github.com/gotestyourself/gotestyourself/skip" "github.com/moby/buildkit/session" "github.com/moby/buildkit/session/filesync" "golang.org/x/sync/errgroup" ) func TestBuildWithSession(t *testing.T) { - d := daemon.New(t, daemon.WithExperimental) - d.StartWithBusybox(t) - defer d.Stop(t) + skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild) - client, err := d.NewClient() - assert.NilError(t, err) + client := testEnv.APIClient() dockerfile := ` FROM busybox @@ -37,7 +34,7 @@ func TestBuildWithSession(t *testing.T) { ) defer fctx.Close() - out := testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile) + out := testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile) assert.Check(t, is.Contains(out, "some content")) fctx.Add("second", "contentcontent") @@ -47,7 +44,7 @@ func TestBuildWithSession(t *testing.T) { RUN cat /second ` - out = testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile) + out = testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile) assert.Check(t, is.Equal(strings.Count(out, "Using cache"), 2)) assert.Check(t, is.Contains(out, "contentcontent")) @@ -55,7 +52,7 @@ func TestBuildWithSession(t *testing.T) { assert.Check(t, err) assert.Check(t, du.BuilderSize > 10) - out = testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile) + out = testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile) assert.Check(t, is.Equal(strings.Count(out, "Using cache"), 4)) du2, err := client.DiskUsage(context.TODO()) @@ -67,7 +64,7 @@ func TestBuildWithSession(t *testing.T) { // FIXME(vdemeester) use sock here res, body, err := request.Do( "/build", - request.Host(d.Sock()), + request.Host(client.DaemonHost()), request.Method(http.MethodPost), request.RawContent(fctx.AsTarReader(t)), request.ContentType("application/x-tar")) @@ -87,7 +84,7 @@ func TestBuildWithSession(t *testing.T) { assert.Check(t, is.Equal(du.BuilderSize, int64(0))) } -func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonSock string, dir, dockerfile string) (outStr string) { +func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonHost string, dir, dockerfile string) (outStr string) { sess, err := session.NewSession("foo1", "foo") assert.Check(t, err) @@ -106,7 +103,7 @@ func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonSock str // FIXME use sock here res, body, err := request.Do( "/build?remote=client-session&session="+sess.ID(), - request.Host(daemonSock), + request.Host(daemonHost), request.Method(http.MethodPost), request.With(func(req *http.Request) error { req.Body = ioutil.NopCloser(strings.NewReader(dockerfile)) diff --git a/integration/build/build_squash_test.go b/integration/build/build_squash_test.go index faac658d7d..9110604e4f 100644 --- a/integration/build/build_squash_test.go +++ b/integration/build/build_squash_test.go @@ -10,20 +10,17 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/integration/internal/container" - "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/internal/test/fakecontext" "github.com/docker/docker/pkg/stdcopy" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" + "github.com/gotestyourself/gotestyourself/skip" ) func TestBuildSquashParent(t *testing.T) { - d := daemon.New(t, daemon.WithExperimental) - d.StartWithBusybox(t) - defer d.Stop(t) + skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild) - client, err := d.NewClient() - assert.NilError(t, err) + client := testEnv.APIClient() dockerfile := ` FROM busybox diff --git a/integration/container/daemon_linux_test.go b/integration/container/daemon_linux_test.go index abcf9b0d06..df6aa683ab 100644 --- a/integration/container/daemon_linux_test.go +++ b/integration/container/daemon_linux_test.go @@ -27,7 +27,7 @@ import ( // the container process, then start dockerd back up and attempt to start the // container again. func TestContainerStartOnDaemonRestart(t *testing.T) { - skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run") + skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run") t.Parallel() d := daemon.New(t) diff --git a/integration/container/restart_test.go b/integration/container/restart_test.go index 630c50f42b..64e37cf749 100644 --- a/integration/container/restart_test.go +++ b/integration/container/restart_test.go @@ -14,7 +14,7 @@ import ( ) func TestDaemonRestartKillContainers(t *testing.T) { - skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run") + skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run") type testCase struct { desc string config *container.Config diff --git a/integration/internal/swarm/service.go b/integration/internal/swarm/service.go index 506bb778de..cea482a1f9 100644 --- a/integration/internal/swarm/service.go +++ b/integration/internal/swarm/service.go @@ -50,7 +50,7 @@ func ContainerPoll(config *poll.Settings) { // NewSwarm creates a swarm daemon for testing func NewSwarm(t *testing.T, testEnv *environment.Execution, ops ...func(*daemon.Daemon)) *daemon.Daemon { t.Helper() - skip.IfCondition(t, testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) if testEnv.DaemonInfo.ExperimentalBuild { ops = append(ops, daemon.WithExperimental) } diff --git a/integration/plugin/authz/main_test.go b/integration/plugin/authz/main_test.go index 1958ce376a..54bf259e95 100644 --- a/integration/plugin/authz/main_test.go +++ b/integration/plugin/authz/main_test.go @@ -47,7 +47,7 @@ func TestMain(m *testing.M) { } func setupTest(t *testing.T) func() { - skip.IfCondition(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon") + skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") environment.ProtectAll(t, testEnv) d = daemon.New(t, daemon.WithExperimental) diff --git a/integration/plugin/graphdriver/external_test.go b/integration/plugin/graphdriver/external_test.go index d42700beab..11e24aec70 100644 --- a/integration/plugin/graphdriver/external_test.go +++ b/integration/plugin/graphdriver/external_test.go @@ -46,7 +46,7 @@ type graphEventsCounter struct { func TestExternalGraphDriver(t *testing.T) { skip.If(t, runtime.GOOS == "windows") - skip.If(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon") + skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") skip.If(t, !requirement.HasHubConnectivity(t)) // Setup plugin(s) @@ -405,7 +405,7 @@ func testGraphDriverPull(c client.APIClient, d *daemon.Daemon) func(*testing.T) func TestGraphdriverPluginV2(t *testing.T) { skip.If(t, runtime.GOOS == "windows") - skip.If(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon") + skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") skip.If(t, !requirement.HasHubConnectivity(t)) skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") skip.If(t, !requirement.Overlay2Supported(testEnv.DaemonInfo.KernelVersion)) diff --git a/integration/plugin/logging/validation_test.go b/integration/plugin/logging/validation_test.go index 7f67aea75c..b0398cc6ab 100644 --- a/integration/plugin/logging/validation_test.go +++ b/integration/plugin/logging/validation_test.go @@ -14,7 +14,7 @@ import ( // Ensure that a daemon with a log plugin set as the default logger for containers // does not keep the daemon from starting. func TestDaemonStartWithLogOpt(t *testing.T) { - skip.IfCondition(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon") + skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") t.Parallel() d := daemon.New(t) diff --git a/integration/plugin/volumes/mounts_test.go b/integration/plugin/volumes/mounts_test.go index 8cb58f2804..97e8222797 100644 --- a/integration/plugin/volumes/mounts_test.go +++ b/integration/plugin/volumes/mounts_test.go @@ -10,11 +10,13 @@ import ( "github.com/docker/docker/internal/test/daemon" "github.com/docker/docker/internal/test/fixtures/plugin" "github.com/gotestyourself/gotestyourself/assert" + "github.com/gotestyourself/gotestyourself/skip" ) // TestPluginWithDevMounts tests very specific regression caused by mounts ordering // (sorted in the daemon). See #36698 func TestPluginWithDevMounts(t *testing.T) { + skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") t.Parallel() d := daemon.New(t) diff --git a/integration/service/plugin_test.go b/integration/service/plugin_test.go index 7617e4d480..29a0398323 100644 --- a/integration/service/plugin_test.go +++ b/integration/service/plugin_test.go @@ -21,6 +21,7 @@ import ( ) func TestServicePlugin(t *testing.T) { + skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") skip.If(t, testEnv.DaemonInfo.OSType == "windows") skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64") defer setupTest(t)() diff --git a/integration/volume/volume_test.go b/integration/volume/volume_test.go index ac67292548..d4dc648771 100644 --- a/integration/volume/volume_test.go +++ b/integration/volume/volume_test.go @@ -16,9 +16,11 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/gotestyourself/gotestyourself/assert" is "github.com/gotestyourself/gotestyourself/assert/cmp" + "github.com/gotestyourself/gotestyourself/skip" ) func TestVolumesCreateAndList(t *testing.T) { + skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon") defer setupTest(t)() client := request.NewAPIClient(t) ctx := context.Background()