Browse code

Update tests to use icmd

Signed-off-by: Daniel Nephin <dnephin@docker.com>

Daniel Nephin authored on 2017/08/24 06:01:29
Showing 44 changed files
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"strings"
6 6
 
7 7
 	"github.com/docker/docker/integration-cli/cli/build/fakecontext"
8
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
8
+	"github.com/gotestyourself/gotestyourself/icmd"
9 9
 )
10 10
 
11 11
 type testingT interface {
... ...
@@ -9,7 +9,7 @@ import (
9 9
 
10 10
 	"github.com/docker/docker/integration-cli/daemon"
11 11
 	"github.com/docker/docker/integration-cli/environment"
12
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
12
+	"github.com/gotestyourself/gotestyourself/icmd"
13 13
 	"github.com/pkg/errors"
14 14
 )
15 15
 
... ...
@@ -23,10 +23,10 @@ import (
23 23
 	"github.com/docker/docker/opts"
24 24
 	"github.com/docker/docker/pkg/ioutils"
25 25
 	"github.com/docker/docker/pkg/stringid"
26
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
27 26
 	"github.com/docker/go-connections/sockets"
28 27
 	"github.com/docker/go-connections/tlsconfig"
29 28
 	"github.com/go-check/check"
29
+	"github.com/gotestyourself/gotestyourself/icmd"
30 30
 	"github.com/pkg/errors"
31 31
 	"github.com/stretchr/testify/require"
32 32
 	"golang.org/x/net/context"
... ...
@@ -11,8 +11,8 @@ import (
11 11
 	"time"
12 12
 
13 13
 	"github.com/docker/docker/integration-cli/cli"
14
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
15 14
 	"github.com/go-check/check"
15
+	"github.com/gotestyourself/gotestyourself/icmd"
16 16
 )
17 17
 
18 18
 const attachWait = 5 * time.Second
... ...
@@ -168,7 +168,7 @@ func (s *DockerSuite) TestAttachPausedContainer(c *check.C) {
168 168
 	dockerCmd(c, "pause", "test")
169 169
 
170 170
 	result := dockerCmdWithResult("attach", "test")
171
-	c.Assert(result, icmd.Matches, icmd.Expected{
171
+	result.Assert(c, icmd.Expected{
172 172
 		Error:    "exit status 1",
173 173
 		ExitCode: 1,
174 174
 		Err:      "You cannot attach to a paused container, unpause it first",
... ...
@@ -25,8 +25,8 @@ import (
25 25
 	"github.com/docker/docker/integration-cli/cli/build/fakestorage"
26 26
 	"github.com/docker/docker/pkg/archive"
27 27
 	"github.com/docker/docker/pkg/stringutils"
28
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
29 28
 	"github.com/go-check/check"
29
+	"github.com/gotestyourself/gotestyourself/icmd"
30 30
 	digest "github.com/opencontainers/go-digest"
31 31
 )
32 32
 
... ...
@@ -3866,7 +3866,7 @@ func (s *DockerSuite) TestBuildDockerfileOutsideContext(c *check.C) {
3866 3866
 		filepath.Join(ctx, "dockerfile2"),
3867 3867
 	} {
3868 3868
 		result := dockerCmdWithResult("build", "-t", name, "--no-cache", "-f", dockerfilePath, ".")
3869
-		c.Assert(result, icmd.Matches, icmd.Expected{
3869
+		result.Assert(c, icmd.Expected{
3870 3870
 			Err:      "must be within the build context",
3871 3871
 			ExitCode: 1,
3872 3872
 		})
... ...
@@ -19,9 +19,9 @@ import (
19 19
 	"github.com/docker/docker/integration-cli/cli"
20 20
 	"github.com/docker/docker/integration-cli/cli/build"
21 21
 	"github.com/docker/docker/integration-cli/cli/build/fakecontext"
22
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
23 22
 	units "github.com/docker/go-units"
24 23
 	"github.com/go-check/check"
24
+	"github.com/gotestyourself/gotestyourself/icmd"
25 25
 )
26 26
 
27 27
 func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
... ...
@@ -11,8 +11,8 @@ import (
11 11
 	"strings"
12 12
 
13 13
 	"github.com/docker/docker/integration-cli/checker"
14
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
15 14
 	"github.com/go-check/check"
15
+	"github.com/gotestyourself/gotestyourself/icmd"
16 16
 )
17 17
 
18 18
 const (
... ...
@@ -14,9 +14,9 @@ import (
14 14
 	"github.com/docker/docker/integration-cli/cli/build"
15 15
 	"github.com/docker/docker/integration-cli/cli/build/fakecontext"
16 16
 	"github.com/docker/docker/pkg/stringid"
17
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
18 17
 	"github.com/docker/go-connections/nat"
19 18
 	"github.com/go-check/check"
19
+	"github.com/gotestyourself/gotestyourself/icmd"
20 20
 )
21 21
 
22 22
 // Make sure we can create a simple container with some args
... ...
@@ -9,8 +9,8 @@ import (
9 9
 
10 10
 	"github.com/docker/docker/integration-cli/checker"
11 11
 	"github.com/docker/docker/pkg/mount"
12
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
13 12
 	"github.com/go-check/check"
13
+	"github.com/gotestyourself/gotestyourself/icmd"
14 14
 	"golang.org/x/sys/unix"
15 15
 )
16 16
 
... ...
@@ -34,11 +34,11 @@ import (
34 34
 	"github.com/docker/docker/opts"
35 35
 	"github.com/docker/docker/pkg/mount"
36 36
 	"github.com/docker/docker/pkg/stringid"
37
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
38 37
 	units "github.com/docker/go-units"
39 38
 	"github.com/docker/libnetwork/iptables"
40 39
 	"github.com/docker/libtrust"
41 40
 	"github.com/go-check/check"
41
+	"github.com/gotestyourself/gotestyourself/icmd"
42 42
 	"github.com/kr/pty"
43 43
 	"golang.org/x/sys/unix"
44 44
 )
... ...
@@ -834,7 +834,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultNetworkInvalidClusterConfig(c *chec
834 834
 
835 835
 	// Start daemon with docker0 bridge
836 836
 	result := icmd.RunCommand("ifconfig", defaultNetworkBridge)
837
-	c.Assert(result, icmd.Matches, icmd.Success)
837
+	result.Assert(c, icmd.Success)
838 838
 
839 839
 	s.d.Restart(c, fmt.Sprintf("--cluster-store=%s", discoveryBackend))
840 840
 }
... ...
@@ -2105,7 +2105,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che
2105 2105
 		ctrBinary,
2106 2106
 		"--address", "unix:///var/run/docker/libcontainerd/docker-containerd.sock",
2107 2107
 		"containers", "resume", cid)
2108
-	t.Assert(result, icmd.Matches, icmd.Success)
2108
+	result.Assert(t, icmd.Success)
2109 2109
 
2110 2110
 	// Give time to containerd to process the command if we don't
2111 2111
 	// the resume event might be received after we do the inspect
... ...
@@ -18,9 +18,8 @@ import (
18 18
 	"github.com/docker/docker/integration-cli/checker"
19 19
 	"github.com/docker/docker/integration-cli/cli"
20 20
 	"github.com/docker/docker/integration-cli/cli/build"
21
-
22
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
23 21
 	"github.com/go-check/check"
22
+	"github.com/gotestyourself/gotestyourself/icmd"
24 23
 	"golang.org/x/net/context"
25 24
 )
26 25
 
... ...
@@ -70,7 +69,7 @@ func (s *DockerSuite) TestEventsUntag(c *check.C) {
70 70
 		Command: []string{dockerBinary, "events", "--since=1"},
71 71
 		Timeout: time.Millisecond * 2500,
72 72
 	})
73
-	c.Assert(result, icmd.Matches, icmd.Expected{Timeout: true})
73
+	result.Assert(c, icmd.Expected{Timeout: true})
74 74
 
75 75
 	events := strings.Split(result.Stdout(), "\n")
76 76
 	nEvents := len(events)
... ...
@@ -264,7 +263,7 @@ func (s *DockerSuite) TestEventsImageLoad(c *check.C) {
264 264
 	dockerCmd(c, "load", "-i", "saveimg.tar")
265 265
 
266 266
 	result := icmd.RunCommand("rm", "-rf", "saveimg.tar")
267
-	c.Assert(result, icmd.Matches, icmd.Success)
267
+	result.Assert(c, icmd.Success)
268 268
 
269 269
 	out, _ = dockerCmd(c, "images", "-q", "--no-trunc", myImageName)
270 270
 	imageID := strings.TrimSpace(out)
... ...
@@ -788,7 +787,7 @@ func (s *DockerSuite) TestEventsFormat(c *check.C) {
788 788
 func (s *DockerSuite) TestEventsFormatBadFunc(c *check.C) {
789 789
 	// make sure it fails immediately, without receiving any event
790 790
 	result := dockerCmdWithResult("events", "--format", "{{badFuncString .}}")
791
-	c.Assert(result, icmd.Matches, icmd.Expected{
791
+	result.Assert(c, icmd.Expected{
792 792
 		Error:    "exit status 64",
793 793
 		ExitCode: 64,
794 794
 		Err:      "Error parsing format: template: :1: function \"badFuncString\" not defined",
... ...
@@ -798,7 +797,7 @@ func (s *DockerSuite) TestEventsFormatBadFunc(c *check.C) {
798 798
 func (s *DockerSuite) TestEventsFormatBadField(c *check.C) {
799 799
 	// make sure it fails immediately, without receiving any event
800 800
 	result := dockerCmdWithResult("events", "--format", "{{.badFieldString}}")
801
-	c.Assert(result, icmd.Matches, icmd.Expected{
801
+	result.Assert(c, icmd.Expected{
802 802
 		Error:    "exit status 64",
803 803
 		ExitCode: 64,
804 804
 		Err:      "Error parsing format: template: :1:2: executing \"\" at <.badFieldString>: can't evaluate field badFieldString in type *events.Message",
... ...
@@ -18,8 +18,8 @@ import (
18 18
 	"github.com/docker/docker/integration-cli/checker"
19 19
 	"github.com/docker/docker/integration-cli/cli"
20 20
 	"github.com/docker/docker/integration-cli/cli/build"
21
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
22 21
 	"github.com/go-check/check"
22
+	"github.com/gotestyourself/gotestyourself/icmd"
23 23
 	"golang.org/x/net/context"
24 24
 )
25 25
 
... ...
@@ -133,7 +133,7 @@ func (s *DockerSuite) TestExecExitStatus(c *check.C) {
133 133
 	runSleepingContainer(c, "-d", "--name", "top")
134 134
 
135 135
 	result := icmd.RunCommand(dockerBinary, "exec", "top", "sh", "-c", "exit 23")
136
-	c.Assert(result, icmd.Matches, icmd.Expected{ExitCode: 23, Error: "exit status 23"})
136
+	result.Assert(c, icmd.Expected{ExitCode: 23, Error: "exit status 23"})
137 137
 }
138 138
 
139 139
 func (s *DockerSuite) TestExecPausedContainer(c *check.C) {
... ...
@@ -5,8 +5,8 @@ import (
5 5
 	"strings"
6 6
 
7 7
 	"github.com/docker/docker/integration-cli/checker"
8
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
9 8
 	"github.com/go-check/check"
9
+	"github.com/gotestyourself/gotestyourself/icmd"
10 10
 )
11 11
 
12 12
 // export an image and try to import it into a new one
... ...
@@ -13,8 +13,8 @@ import (
13 13
 	"github.com/docker/docker/integration-cli/checker"
14 14
 	"github.com/docker/docker/integration-cli/cli/build"
15 15
 	"github.com/docker/docker/pkg/stringid"
16
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
17 16
 	"github.com/go-check/check"
17
+	"github.com/gotestyourself/gotestyourself/icmd"
18 18
 )
19 19
 
20 20
 func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) {
... ...
@@ -11,8 +11,8 @@ import (
11 11
 
12 12
 	"github.com/docker/docker/integration-cli/checker"
13 13
 	"github.com/docker/docker/integration-cli/cli"
14
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
15 14
 	"github.com/go-check/check"
15
+	"github.com/gotestyourself/gotestyourself/icmd"
16 16
 )
17 17
 
18 18
 func (s *DockerSuite) TestImportDisplay(c *check.C) {
... ...
@@ -138,5 +138,5 @@ func (s *DockerSuite) TestImportWithQuotedChanges(c *check.C) {
138 138
 	image := strings.TrimSpace(result.Stdout())
139 139
 
140 140
 	result = cli.DockerCmd(c, "run", "--rm", image, "true")
141
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: icmd.None})
141
+	result.Assert(c, icmd.Expected{Out: icmd.None})
142 142
 }
... ...
@@ -11,8 +11,8 @@ import (
11 11
 	"github.com/docker/docker/api/types"
12 12
 	"github.com/docker/docker/api/types/container"
13 13
 	"github.com/docker/docker/integration-cli/checker"
14
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
15 14
 	"github.com/go-check/check"
15
+	"github.com/gotestyourself/gotestyourself/icmd"
16 16
 )
17 17
 
18 18
 func checkValidGraphDriver(c *check.C, name string) {
... ...
@@ -8,8 +8,8 @@ import (
8 8
 	"github.com/docker/docker/client"
9 9
 	"github.com/docker/docker/integration-cli/checker"
10 10
 	"github.com/docker/docker/integration-cli/cli"
11
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
12 11
 	"github.com/go-check/check"
12
+	"github.com/gotestyourself/gotestyourself/icmd"
13 13
 	"golang.org/x/net/context"
14 14
 )
15 15
 
... ...
@@ -11,8 +11,8 @@ import (
11 11
 	"github.com/docker/docker/integration-cli/checker"
12 12
 	"github.com/docker/docker/integration-cli/cli"
13 13
 	"github.com/docker/docker/pkg/jsonlog"
14
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
15 14
 	"github.com/go-check/check"
15
+	"github.com/gotestyourself/gotestyourself/icmd"
16 16
 )
17 17
 
18 18
 // This used to work, it test a log of PageSize-1 (gh#4851)
... ...
@@ -20,7 +20,6 @@ import (
20 20
 	"github.com/docker/docker/integration-cli/cli"
21 21
 	"github.com/docker/docker/integration-cli/daemon"
22 22
 	"github.com/docker/docker/pkg/stringid"
23
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
24 23
 	"github.com/docker/docker/runconfig"
25 24
 	"github.com/docker/libnetwork/driverapi"
26 25
 	remoteapi "github.com/docker/libnetwork/drivers/remote/api"
... ...
@@ -28,6 +27,7 @@ import (
28 28
 	remoteipam "github.com/docker/libnetwork/ipams/remote/api"
29 29
 	"github.com/docker/libnetwork/netlabel"
30 30
 	"github.com/go-check/check"
31
+	"github.com/gotestyourself/gotestyourself/icmd"
31 32
 	"github.com/vishvananda/netlink"
32 33
 	"golang.org/x/sys/unix"
33 34
 )
... ...
@@ -482,7 +482,7 @@ func (s *DockerSuite) TestDockerNetworkInspectWithID(c *check.C) {
482 482
 
483 483
 func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) {
484 484
 	result := dockerCmdWithResult("network", "inspect", "host", "none")
485
-	c.Assert(result, icmd.Matches, icmd.Success)
485
+	result.Assert(c, icmd.Success)
486 486
 
487 487
 	networkResources := []types.NetworkResource{}
488 488
 	err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
... ...
@@ -494,7 +494,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
494 494
 	// non-existent network was not at the beginning of the inspect list
495 495
 	// This should print an error, return an exitCode 1 and print the host network
496 496
 	result := dockerCmdWithResult("network", "inspect", "host", "nonexistent")
497
-	c.Assert(result, icmd.Matches, icmd.Expected{
497
+	result.Assert(c, icmd.Expected{
498 498
 		ExitCode: 1,
499 499
 		Err:      "Error: No such network: nonexistent",
500 500
 		Out:      "host",
... ...
@@ -508,7 +508,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
508 508
 	// Only one non-existent network to inspect
509 509
 	// Should print an error and return an exitCode, nothing else
510 510
 	result = dockerCmdWithResult("network", "inspect", "nonexistent")
511
-	c.Assert(result, icmd.Matches, icmd.Expected{
511
+	result.Assert(c, icmd.Expected{
512 512
 		ExitCode: 1,
513 513
 		Err:      "Error: No such network: nonexistent",
514 514
 		Out:      "[]",
... ...
@@ -517,7 +517,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
517 517
 	// non-existent network was at the beginning of the inspect list
518 518
 	// Should not fail fast, and still print host network but print an error
519 519
 	result = dockerCmdWithResult("network", "inspect", "nonexistent", "host")
520
-	c.Assert(result, icmd.Matches, icmd.Expected{
520
+	result.Assert(c, icmd.Expected{
521 521
 		ExitCode: 1,
522 522
 		Err:      "Error: No such network: nonexistent",
523 523
 		Out:      "host",
... ...
@@ -16,8 +16,8 @@ import (
16 16
 	"github.com/docker/docker/integration-cli/daemon"
17 17
 	"github.com/docker/docker/integration-cli/fixtures/plugin"
18 18
 	"github.com/docker/docker/integration-cli/request"
19
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
20 19
 	"github.com/go-check/check"
20
+	"github.com/gotestyourself/gotestyourself/icmd"
21 21
 	"golang.org/x/net/context"
22 22
 )
23 23
 
... ...
@@ -5,8 +5,8 @@ import (
5 5
 	"strings"
6 6
 
7 7
 	"github.com/docker/docker/integration-cli/checker"
8
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
9 8
 	"github.com/go-check/check"
9
+	"github.com/gotestyourself/gotestyourself/icmd"
10 10
 )
11 11
 
12 12
 func (s *DockerSuite) TestCLIProxyDisableProxyUnixSock(c *check.C) {
... ...
@@ -14,8 +14,8 @@ import (
14 14
 	"github.com/docker/docker/integration-cli/cli"
15 15
 	"github.com/docker/docker/integration-cli/cli/build"
16 16
 	"github.com/docker/docker/pkg/stringid"
17
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
18 17
 	"github.com/go-check/check"
18
+	"github.com/gotestyourself/gotestyourself/icmd"
19 19
 )
20 20
 
21 21
 func (s *DockerSuite) TestPsListContainersBase(c *check.C) {
... ...
@@ -206,7 +206,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
206 206
 	c.Assert(containerOut, checker.Equals, secondID)
207 207
 
208 208
 	result := cli.Docker(cli.Args("ps", "-a", "-q", "--filter=status=rubbish"), cli.WithTimeout(time.Second*60))
209
-	c.Assert(result, icmd.Matches, icmd.Expected{
209
+	result.Assert(c, icmd.Expected{
210 210
 		ExitCode: 1,
211 211
 		Err:      "Invalid filter 'status=rubbish'",
212 212
 	})
... ...
@@ -15,8 +15,8 @@ import (
15 15
 	"github.com/docker/distribution/manifest/schema2"
16 16
 	"github.com/docker/docker/integration-cli/checker"
17 17
 	"github.com/docker/docker/integration-cli/cli/build"
18
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
19 18
 	"github.com/go-check/check"
19
+	"github.com/gotestyourself/gotestyourself/icmd"
20 20
 	"github.com/opencontainers/go-digest"
21 21
 )
22 22
 
... ...
@@ -7,8 +7,8 @@ import (
7 7
 	"github.com/docker/docker/integration-cli/checker"
8 8
 	"github.com/docker/docker/integration-cli/cli"
9 9
 	"github.com/docker/docker/integration-cli/cli/build"
10
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
11 10
 	"github.com/go-check/check"
11
+	"github.com/gotestyourself/gotestyourself/icmd"
12 12
 )
13 13
 
14 14
 func (s *DockerTrustSuite) TestTrustedPull(c *check.C) {
... ...
@@ -16,8 +16,8 @@ import (
16 16
 	"github.com/docker/docker/integration-cli/checker"
17 17
 	"github.com/docker/docker/integration-cli/cli"
18 18
 	"github.com/docker/docker/integration-cli/cli/build"
19
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
20 19
 	"github.com/go-check/check"
20
+	"github.com/gotestyourself/gotestyourself/icmd"
21 21
 )
22 22
 
23 23
 // Pushing an image to a private registry.
... ...
@@ -5,8 +5,8 @@ import (
5 5
 
6 6
 	"github.com/docker/docker/integration-cli/checker"
7 7
 	"github.com/docker/docker/pkg/stringid"
8
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
9 8
 	"github.com/go-check/check"
9
+	"github.com/gotestyourself/gotestyourself/icmd"
10 10
 )
11 11
 
12 12
 func (s *DockerSuite) TestRenameStoppedContainer(c *check.C) {
... ...
@@ -63,7 +63,7 @@ func (s *DockerSuite) TestRenameCheckNames(c *check.C) {
63 63
 	c.Assert(name, checker.Equals, "/"+newName, check.Commentf("Failed to rename container %s", name))
64 64
 
65 65
 	result := dockerCmdWithResult("inspect", "-f={{.Name}}", "--type=container", "first_name")
66
-	c.Assert(result, icmd.Matches, icmd.Expected{
66
+	result.Assert(c, icmd.Expected{
67 67
 		ExitCode: 1,
68 68
 		Err:      "No such container: first_name",
69 69
 	})
... ...
@@ -9,8 +9,8 @@ import (
9 9
 	"github.com/docker/docker/integration-cli/cli"
10 10
 	"github.com/docker/docker/integration-cli/cli/build"
11 11
 	"github.com/docker/docker/pkg/stringid"
12
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
13 12
 	"github.com/go-check/check"
13
+	"github.com/gotestyourself/gotestyourself/icmd"
14 14
 )
15 15
 
16 16
 func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
... ...
@@ -28,12 +28,12 @@ import (
28 28
 	"github.com/docker/docker/pkg/mount"
29 29
 	"github.com/docker/docker/pkg/stringid"
30 30
 	"github.com/docker/docker/pkg/stringutils"
31
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
32 31
 	"github.com/docker/docker/runconfig"
33 32
 	"github.com/docker/go-connections/nat"
34 33
 	"github.com/docker/libnetwork/resolvconf"
35 34
 	"github.com/docker/libnetwork/types"
36 35
 	"github.com/go-check/check"
36
+	"github.com/gotestyourself/gotestyourself/icmd"
37 37
 	libcontainerUser "github.com/opencontainers/runc/libcontainer/user"
38 38
 )
39 39
 
... ...
@@ -1798,7 +1798,7 @@ func (s *DockerSuite) TestRunInteractiveWithRestartPolicy(c *check.C) {
1798 1798
 	}()
1799 1799
 
1800 1800
 	result = icmd.WaitOnCmd(60*time.Second, result)
1801
-	c.Assert(result, icmd.Matches, icmd.Expected{ExitCode: 11})
1801
+	result.Assert(c, icmd.Expected{ExitCode: 11})
1802 1802
 }
1803 1803
 
1804 1804
 // Test for #2267
... ...
@@ -23,8 +23,8 @@ import (
23 23
 	"github.com/docker/docker/pkg/mount"
24 24
 	"github.com/docker/docker/pkg/parsers"
25 25
 	"github.com/docker/docker/pkg/sysinfo"
26
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
27 26
 	"github.com/go-check/check"
27
+	"github.com/gotestyourself/gotestyourself/icmd"
28 28
 	"github.com/kr/pty"
29 29
 )
30 30
 
... ...
@@ -17,8 +17,8 @@ import (
17 17
 
18 18
 	"github.com/docker/docker/integration-cli/checker"
19 19
 	"github.com/docker/docker/integration-cli/cli/build"
20
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
21 20
 	"github.com/go-check/check"
21
+	"github.com/gotestyourself/gotestyourself/icmd"
22 22
 	digest "github.com/opencontainers/go-digest"
23 23
 )
24 24
 
... ...
@@ -13,8 +13,8 @@ import (
13 13
 
14 14
 	"github.com/docker/docker/integration-cli/checker"
15 15
 	"github.com/docker/docker/integration-cli/cli/build"
16
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
17 16
 	"github.com/go-check/check"
17
+	"github.com/gotestyourself/gotestyourself/icmd"
18 18
 	"github.com/kr/pty"
19 19
 )
20 20
 
... ...
@@ -12,8 +12,8 @@ import (
12 12
 
13 13
 	"github.com/docker/docker/integration-cli/checker"
14 14
 	"github.com/docker/docker/integration-cli/daemon"
15
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
16 15
 	"github.com/go-check/check"
16
+	"github.com/gotestyourself/gotestyourself/icmd"
17 17
 )
18 18
 
19 19
 type logMessage struct {
... ...
@@ -287,7 +287,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTTY(c *check.C) {
287 287
 	result = icmd.RunCmd(cmd)
288 288
 	// for some reason there is carriage return in the output. i think this is
289 289
 	// just expected.
290
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: "out\r\nerr\r\n"})
290
+	result.Assert(c, icmd.Expected{Out: "out\r\nerr\r\n"})
291 291
 }
292 292
 
293 293
 func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
... ...
@@ -307,7 +307,7 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
307 307
 	))
308 308
 
309 309
 	// confirm that the command succeeded
310
-	c.Assert(result, icmd.Matches, icmd.Expected{})
310
+	result.Assert(c, icmd.Expected{})
311 311
 	// get the service id
312 312
 	id := strings.TrimSpace(result.Stdout())
313 313
 	c.Assert(id, checker.Not(checker.Equals), "")
... ...
@@ -322,9 +322,9 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
322 322
 	containerID := strings.TrimSpace(result.Stdout())
323 323
 	c.Assert(containerID, checker.Not(checker.Equals), "")
324 324
 	result = icmd.RunCmd(d.Command("stop", containerID))
325
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: containerID})
325
+	result.Assert(c, icmd.Expected{Out: containerID})
326 326
 	result = icmd.RunCmd(d.Command("rm", containerID))
327
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: containerID})
327
+	result.Assert(c, icmd.Expected{Out: containerID})
328 328
 
329 329
 	// run logs. use tail 2 to make sure we don't try to get a bunch of logs
330 330
 	// somehow and slow down execution time
... ...
@@ -336,7 +336,7 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
336 336
 	// then, assert that the result matches expected. if the command timed out,
337 337
 	// if the command is timed out, result.Timeout will be true, but the
338 338
 	// Expected defaults to false
339
-	c.Assert(result, icmd.Matches, icmd.Expected{})
339
+	result.Assert(c, icmd.Expected{})
340 340
 }
341 341
 
342 342
 func (s *DockerSwarmSuite) TestServiceLogsDetails(c *check.C) {
... ...
@@ -376,12 +376,12 @@ func (s *DockerSwarmSuite) TestServiceLogsDetails(c *check.C) {
376 376
 	// in this case, we should get details and we should get log message, but
377 377
 	// there will also be context as details (which will fall after the detail
378 378
 	// we inserted in alphabetical order
379
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: "asdf=test1"})
380
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: "LogLine"})
379
+	result.Assert(c, icmd.Expected{Out: "asdf=test1"})
380
+	result.Assert(c, icmd.Expected{Out: "LogLine"})
381 381
 
382 382
 	// call service logs with details. this time, don't pass raw
383 383
 	result = icmd.RunCmd(d.Command("service", "logs", "--details", id))
384 384
 	// in this case, we should get details space logmessage as well. the context
385 385
 	// is part of the pretty part of the logline
386
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: "asdf=test1 LogLine"})
386
+	result.Assert(c, icmd.Expected{Out: "asdf=test1 LogLine"})
387 387
 }
... ...
@@ -7,8 +7,8 @@ import (
7 7
 
8 8
 	"github.com/docker/docker/integration-cli/checker"
9 9
 	"github.com/docker/docker/integration-cli/cli"
10
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
11 10
 	"github.com/go-check/check"
11
+	"github.com/gotestyourself/gotestyourself/icmd"
12 12
 )
13 13
 
14 14
 // Regression test for https://github.com/docker/docker/issues/7843
... ...
@@ -22,12 +22,12 @@ import (
22 22
 	"github.com/docker/docker/integration-cli/checker"
23 23
 	"github.com/docker/docker/integration-cli/cli"
24 24
 	"github.com/docker/docker/integration-cli/daemon"
25
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
26 25
 	"github.com/docker/libnetwork/driverapi"
27 26
 	"github.com/docker/libnetwork/ipamapi"
28 27
 	remoteipam "github.com/docker/libnetwork/ipams/remote/api"
29 28
 	"github.com/go-check/check"
30 29
 	"github.com/gotestyourself/gotestyourself/fs"
30
+	"github.com/gotestyourself/gotestyourself/icmd"
31 31
 	"github.com/vishvananda/netlink"
32 32
 	"golang.org/x/net/context"
33 33
 )
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"strings"
5 5
 
6 6
 	"github.com/docker/docker/integration-cli/checker"
7
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
8 7
 	"github.com/go-check/check"
8
+	"github.com/gotestyourself/gotestyourself/icmd"
9 9
 )
10 10
 
11 11
 func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
... ...
@@ -20,7 +20,7 @@ func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
20 20
 		expected = icmd.Expected{Out: "PID"}
21 21
 	}
22 22
 	result := dockerCmdWithResult("top", cleanedContainerID, "-o", "pid")
23
-	c.Assert(result, icmd.Matches, expected)
23
+	result.Assert(c, expected)
24 24
 }
25 25
 
26 26
 func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {
... ...
@@ -6,8 +6,8 @@ import (
6 6
 
7 7
 	"github.com/docker/docker/integration-cli/checker"
8 8
 	"github.com/docker/docker/integration-cli/cli"
9
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
10 9
 	"github.com/go-check/check"
10
+	"github.com/gotestyourself/gotestyourself/icmd"
11 11
 )
12 12
 
13 13
 func (s *DockerSuite) TestUpdateRestartPolicy(c *check.C) {
... ...
@@ -14,8 +14,8 @@ import (
14 14
 	"github.com/docker/docker/client"
15 15
 	"github.com/docker/docker/integration-cli/checker"
16 16
 	"github.com/docker/docker/integration-cli/cli/build"
17
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
18 17
 	"github.com/go-check/check"
18
+	"github.com/gotestyourself/gotestyourself/icmd"
19 19
 	"golang.org/x/net/context"
20 20
 )
21 21
 
... ...
@@ -58,7 +58,7 @@ func (s *DockerSuite) TestVolumeCLIInspectMulti(c *check.C) {
58 58
 	dockerCmd(c, "volume", "create", "test3")
59 59
 
60 60
 	result := dockerCmdWithResult("volume", "inspect", "--format={{ .Name }}", "test1", "test2", "doesnotexist", "test3")
61
-	c.Assert(result, icmd.Matches, icmd.Expected{
61
+	result.Assert(c, icmd.Expected{
62 62
 		ExitCode: 1,
63 63
 		Err:      "No such volume: doesnotexist",
64 64
 	})
... ...
@@ -7,8 +7,8 @@ import (
7 7
 	"time"
8 8
 
9 9
 	"github.com/docker/docker/integration-cli/checker"
10
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
11 10
 	"github.com/go-check/check"
11
+	"github.com/gotestyourself/gotestyourself/icmd"
12 12
 )
13 13
 
14 14
 // non-blocking wait with 0 exit code
... ...
@@ -9,8 +9,8 @@ import (
9 9
 	"github.com/docker/docker/integration-cli/checker"
10 10
 	"github.com/docker/docker/integration-cli/cli"
11 11
 	"github.com/docker/docker/pkg/parsers/kernel"
12
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
13 12
 	"github.com/go-check/check"
13
+	"github.com/gotestyourself/gotestyourself/icmd"
14 14
 )
15 15
 
16 16
 // ensure Kernel version is >= v3.9 for macvlan support
... ...
@@ -382,7 +382,7 @@ func (s *DockerSuite) TestDockerNetworkMacVlanBridgeInternalMode(c *check.C) {
382 382
 
383 383
 	// access outside of the network should fail
384 384
 	result := cli.Docker(cli.Args("exec", "first", "ping", "-c", "1", "-w", "1", "8.8.8.8"), cli.WithTimeout(time.Second))
385
-	c.Assert(result, icmd.Matches, icmd.Expected{Timeout: true})
385
+	result.Assert(c, icmd.Expected{Timeout: true})
386 386
 
387 387
 	// intra-network communications should succeed
388 388
 	cli.DockerCmd(c, "exec", "second", "ping", "-c", "1", "first")
... ...
@@ -421,7 +421,7 @@ func (s *DockerSuite) TestDockerNetworkIpvlanL2InternalMode(c *check.C) {
421 421
 
422 422
 	// access outside of the network should fail
423 423
 	result := cli.Docker(cli.Args("exec", "first", "ping", "-c", "1", "-w", "1", "8.8.8.8"), cli.WithTimeout(time.Second))
424
-	c.Assert(result, icmd.Matches, icmd.Expected{Timeout: true})
424
+	result.Assert(c, icmd.Expected{Timeout: true})
425 425
 	// intra-network communications should succeed
426 426
 	cli.DockerCmd(c, "exec", "second", "ping", "-c", "1", "first")
427 427
 }
... ...
@@ -461,7 +461,7 @@ func (s *DockerSuite) TestDockerNetworkIpvlanL3InternalMode(c *check.C) {
461 461
 
462 462
 	// access outside of the network should fail
463 463
 	result := cli.Docker(cli.Args("exec", "first", "ping", "-c", "1", "-w", "1", "8.8.8.8"), cli.WithTimeout(time.Second))
464
-	c.Assert(result, icmd.Matches, icmd.Expected{Timeout: true})
464
+	result.Assert(c, icmd.Expected{Timeout: true})
465 465
 	// intra-network communications should succeed
466 466
 	cli.DockerCmd(c, "exec", "second", "ping", "-c", "1", "first")
467 467
 }
... ...
@@ -21,8 +21,8 @@ import (
21 21
 	"github.com/docker/docker/integration-cli/daemon"
22 22
 	"github.com/docker/docker/integration-cli/registry"
23 23
 	"github.com/docker/docker/integration-cli/request"
24
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
25 24
 	"github.com/go-check/check"
25
+	"github.com/gotestyourself/gotestyourself/icmd"
26 26
 	"golang.org/x/net/context"
27 27
 )
28 28
 
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"github.com/docker/docker/api/types"
8 8
 	"github.com/docker/docker/api/types/filters"
9 9
 	"github.com/docker/docker/client"
10
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
10
+	"github.com/gotestyourself/gotestyourself/icmd"
11 11
 	"golang.org/x/net/context"
12 12
 )
13 13
 
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"strings"
5 5
 
6 6
 	"github.com/docker/docker/integration-cli/fixtures/load"
7
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
7
+	"github.com/gotestyourself/gotestyourself/icmd"
8 8
 )
9 9
 
10 10
 type protectedElements struct {
... ...
@@ -18,9 +18,9 @@ import (
18 18
 	"github.com/docker/docker/integration-cli/cli"
19 19
 	"github.com/docker/docker/integration-cli/fixtures/plugin"
20 20
 	"github.com/docker/docker/integration-cli/request"
21
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
22 21
 	"github.com/docker/go-connections/tlsconfig"
23 22
 	"github.com/go-check/check"
23
+	"github.com/gotestyourself/gotestyourself/icmd"
24 24
 )
25 25
 
26 26
 var notaryBinary = "notary"
... ...
@@ -8,7 +8,7 @@ import (
8 8
 	"strings"
9 9
 
10 10
 	"github.com/docker/docker/pkg/stringutils"
11
-	"github.com/docker/docker/pkg/testutil/cmd"
11
+	"github.com/gotestyourself/gotestyourself/icmd"
12 12
 	"github.com/pkg/errors"
13 13
 )
14 14
 
... ...
@@ -20,15 +20,15 @@ func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) {
20 20
 }
21 21
 
22 22
 // TODO: update code to call cmd.RunCmd directly, and remove this function
23
-// Deprecated: use pkg/testutil/cmd instead
23
+// Deprecated: use gotestyourself/gotestyourself/icmd
24 24
 func runCommandWithOutput(execCmd *exec.Cmd) (string, int, error) {
25
-	result := cmd.RunCmd(transformCmd(execCmd))
25
+	result := icmd.RunCmd(transformCmd(execCmd))
26 26
 	return result.Combined(), result.ExitCode, result.Error
27 27
 }
28 28
 
29 29
 // Temporary shim for migrating commands to the new function
30
-func transformCmd(execCmd *exec.Cmd) cmd.Cmd {
31
-	return cmd.Cmd{
30
+func transformCmd(execCmd *exec.Cmd) icmd.Cmd {
31
+	return icmd.Cmd{
32 32
 		Command: execCmd.Args,
33 33
 		Env:     execCmd.Env,
34 34
 		Dir:     execCmd.Dir,