Browse code

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 authored on 2018/04/25 18:03:43
Showing 11 changed files
... ...
@@ -8,23 +8,20 @@ import (
8 8
 	"testing"
9 9
 
10 10
 	dclient "github.com/docker/docker/client"
11
-	"github.com/docker/docker/internal/test/daemon"
12 11
 	"github.com/docker/docker/internal/test/fakecontext"
13 12
 	"github.com/docker/docker/internal/test/request"
14 13
 	"github.com/gotestyourself/gotestyourself/assert"
15 14
 	is "github.com/gotestyourself/gotestyourself/assert/cmp"
15
+	"github.com/gotestyourself/gotestyourself/skip"
16 16
 	"github.com/moby/buildkit/session"
17 17
 	"github.com/moby/buildkit/session/filesync"
18 18
 	"golang.org/x/sync/errgroup"
19 19
 )
20 20
 
21 21
 func TestBuildWithSession(t *testing.T) {
22
-	d := daemon.New(t, daemon.WithExperimental)
23
-	d.StartWithBusybox(t)
24
-	defer d.Stop(t)
22
+	skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
25 23
 
26
-	client, err := d.NewClient()
27
-	assert.NilError(t, err)
24
+	client := testEnv.APIClient()
28 25
 
29 26
 	dockerfile := `
30 27
 		FROM busybox
... ...
@@ -37,7 +34,7 @@ func TestBuildWithSession(t *testing.T) {
37 37
 	)
38 38
 	defer fctx.Close()
39 39
 
40
-	out := testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile)
40
+	out := testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile)
41 41
 	assert.Check(t, is.Contains(out, "some content"))
42 42
 
43 43
 	fctx.Add("second", "contentcontent")
... ...
@@ -47,7 +44,7 @@ func TestBuildWithSession(t *testing.T) {
47 47
 	RUN cat /second
48 48
 	`
49 49
 
50
-	out = testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile)
50
+	out = testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile)
51 51
 	assert.Check(t, is.Equal(strings.Count(out, "Using cache"), 2))
52 52
 	assert.Check(t, is.Contains(out, "contentcontent"))
53 53
 
... ...
@@ -55,7 +52,7 @@ func TestBuildWithSession(t *testing.T) {
55 55
 	assert.Check(t, err)
56 56
 	assert.Check(t, du.BuilderSize > 10)
57 57
 
58
-	out = testBuildWithSession(t, client, d.Sock(), fctx.Dir, dockerfile)
58
+	out = testBuildWithSession(t, client, client.DaemonHost(), fctx.Dir, dockerfile)
59 59
 	assert.Check(t, is.Equal(strings.Count(out, "Using cache"), 4))
60 60
 
61 61
 	du2, err := client.DiskUsage(context.TODO())
... ...
@@ -67,7 +64,7 @@ func TestBuildWithSession(t *testing.T) {
67 67
 	// FIXME(vdemeester) use sock here
68 68
 	res, body, err := request.Do(
69 69
 		"/build",
70
-		request.Host(d.Sock()),
70
+		request.Host(client.DaemonHost()),
71 71
 		request.Method(http.MethodPost),
72 72
 		request.RawContent(fctx.AsTarReader(t)),
73 73
 		request.ContentType("application/x-tar"))
... ...
@@ -87,7 +84,7 @@ func TestBuildWithSession(t *testing.T) {
87 87
 	assert.Check(t, is.Equal(du.BuilderSize, int64(0)))
88 88
 }
89 89
 
90
-func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonSock string, dir, dockerfile string) (outStr string) {
90
+func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonHost string, dir, dockerfile string) (outStr string) {
91 91
 	sess, err := session.NewSession("foo1", "foo")
92 92
 	assert.Check(t, err)
93 93
 
... ...
@@ -106,7 +103,7 @@ func testBuildWithSession(t *testing.T, client dclient.APIClient, daemonSock str
106 106
 		// FIXME use sock here
107 107
 		res, body, err := request.Do(
108 108
 			"/build?remote=client-session&session="+sess.ID(),
109
-			request.Host(daemonSock),
109
+			request.Host(daemonHost),
110 110
 			request.Method(http.MethodPost),
111 111
 			request.With(func(req *http.Request) error {
112 112
 				req.Body = ioutil.NopCloser(strings.NewReader(dockerfile))
... ...
@@ -10,20 +10,17 @@ import (
10 10
 
11 11
 	"github.com/docker/docker/api/types"
12 12
 	"github.com/docker/docker/integration/internal/container"
13
-	"github.com/docker/docker/internal/test/daemon"
14 13
 	"github.com/docker/docker/internal/test/fakecontext"
15 14
 	"github.com/docker/docker/pkg/stdcopy"
16 15
 	"github.com/gotestyourself/gotestyourself/assert"
17 16
 	is "github.com/gotestyourself/gotestyourself/assert/cmp"
17
+	"github.com/gotestyourself/gotestyourself/skip"
18 18
 )
19 19
 
20 20
 func TestBuildSquashParent(t *testing.T) {
21
-	d := daemon.New(t, daemon.WithExperimental)
22
-	d.StartWithBusybox(t)
23
-	defer d.Stop(t)
21
+	skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
24 22
 
25
-	client, err := d.NewClient()
26
-	assert.NilError(t, err)
23
+	client := testEnv.APIClient()
27 24
 
28 25
 	dockerfile := `
29 26
 		FROM busybox
... ...
@@ -27,7 +27,7 @@ import (
27 27
 // the container process, then start dockerd back up and attempt to start the
28 28
 // container again.
29 29
 func TestContainerStartOnDaemonRestart(t *testing.T) {
30
-	skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run")
30
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
31 31
 	t.Parallel()
32 32
 
33 33
 	d := daemon.New(t)
... ...
@@ -14,7 +14,7 @@ import (
14 14
 )
15 15
 
16 16
 func TestDaemonRestartKillContainers(t *testing.T) {
17
-	skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run")
17
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
18 18
 	type testCase struct {
19 19
 		desc       string
20 20
 		config     *container.Config
... ...
@@ -50,7 +50,7 @@ func ContainerPoll(config *poll.Settings) {
50 50
 // NewSwarm creates a swarm daemon for testing
51 51
 func NewSwarm(t *testing.T, testEnv *environment.Execution, ops ...func(*daemon.Daemon)) *daemon.Daemon {
52 52
 	t.Helper()
53
-	skip.IfCondition(t, testEnv.IsRemoteDaemon())
53
+	skip.If(t, testEnv.IsRemoteDaemon)
54 54
 	if testEnv.DaemonInfo.ExperimentalBuild {
55 55
 		ops = append(ops, daemon.WithExperimental)
56 56
 	}
... ...
@@ -47,7 +47,7 @@ func TestMain(m *testing.M) {
47 47
 }
48 48
 
49 49
 func setupTest(t *testing.T) func() {
50
-	skip.IfCondition(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon")
50
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
51 51
 	environment.ProtectAll(t, testEnv)
52 52
 
53 53
 	d = daemon.New(t, daemon.WithExperimental)
... ...
@@ -46,7 +46,7 @@ type graphEventsCounter struct {
46 46
 
47 47
 func TestExternalGraphDriver(t *testing.T) {
48 48
 	skip.If(t, runtime.GOOS == "windows")
49
-	skip.If(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon")
49
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
50 50
 	skip.If(t, !requirement.HasHubConnectivity(t))
51 51
 
52 52
 	// Setup plugin(s)
... ...
@@ -405,7 +405,7 @@ func testGraphDriverPull(c client.APIClient, d *daemon.Daemon) func(*testing.T)
405 405
 
406 406
 func TestGraphdriverPluginV2(t *testing.T) {
407 407
 	skip.If(t, runtime.GOOS == "windows")
408
-	skip.If(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon")
408
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
409 409
 	skip.If(t, !requirement.HasHubConnectivity(t))
410 410
 	skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
411 411
 	skip.If(t, !requirement.Overlay2Supported(testEnv.DaemonInfo.KernelVersion))
... ...
@@ -14,7 +14,7 @@ import (
14 14
 // Ensure that a daemon with a log plugin set as the default logger for containers
15 15
 // does not keep the daemon from starting.
16 16
 func TestDaemonStartWithLogOpt(t *testing.T) {
17
-	skip.IfCondition(t, testEnv.IsRemoteDaemon(), "cannot run daemon when remote daemon")
17
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
18 18
 	t.Parallel()
19 19
 
20 20
 	d := daemon.New(t)
... ...
@@ -10,11 +10,13 @@ import (
10 10
 	"github.com/docker/docker/internal/test/daemon"
11 11
 	"github.com/docker/docker/internal/test/fixtures/plugin"
12 12
 	"github.com/gotestyourself/gotestyourself/assert"
13
+	"github.com/gotestyourself/gotestyourself/skip"
13 14
 )
14 15
 
15 16
 // TestPluginWithDevMounts tests very specific regression caused by mounts ordering
16 17
 // (sorted in the daemon). See #36698
17 18
 func TestPluginWithDevMounts(t *testing.T) {
19
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
18 20
 	t.Parallel()
19 21
 
20 22
 	d := daemon.New(t)
... ...
@@ -21,6 +21,7 @@ import (
21 21
 )
22 22
 
23 23
 func TestServicePlugin(t *testing.T) {
24
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
24 25
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
25 26
 	skip.If(t, os.Getenv("DOCKER_ENGINE_GOARCH") != "amd64")
26 27
 	defer setupTest(t)()
... ...
@@ -16,9 +16,11 @@ import (
16 16
 	"github.com/google/go-cmp/cmp/cmpopts"
17 17
 	"github.com/gotestyourself/gotestyourself/assert"
18 18
 	is "github.com/gotestyourself/gotestyourself/assert/cmp"
19
+	"github.com/gotestyourself/gotestyourself/skip"
19 20
 )
20 21
 
21 22
 func TestVolumesCreateAndList(t *testing.T) {
23
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
22 24
 	defer setupTest(t)()
23 25
 	client := request.NewAPIClient(t)
24 26
 	ctx := context.Background()