浏览代码

Skip some test on remote daemon for e2e run(s)

We really need to run those on the CI too at some point.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Tibor Vass <tibor@docker.com>
Vincent Demeester 7 年之前
父节点
当前提交
ef2c2040c2

+ 9 - 12
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))

+ 3 - 6
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

+ 1 - 1
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)

+ 1 - 1
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

+ 1 - 1
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)
 	}

+ 1 - 1
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)

+ 2 - 2
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))

+ 1 - 1
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)

+ 2 - 0
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)

+ 1 - 0
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)()

+ 2 - 0
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()