Bläddra i källkod

Update tests to use icmd

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Daniel Nephin 8 år sedan
förälder
incheckning
92427b3a81
44 ändrade filer med 78 tillägg och 79 borttagningar
  1. 1 1
      integration-cli/cli/build/build.go
  2. 1 1
      integration-cli/cli/cli.go
  3. 1 1
      integration-cli/daemon/daemon.go
  4. 2 2
      integration-cli/docker_cli_attach_test.go
  5. 2 2
      integration-cli/docker_cli_build_test.go
  6. 1 1
      integration-cli/docker_cli_build_unix_test.go
  7. 1 1
      integration-cli/docker_cli_cp_test.go
  8. 1 1
      integration-cli/docker_cli_create_test.go
  9. 1 1
      integration-cli/docker_cli_daemon_plugins_test.go
  10. 3 3
      integration-cli/docker_cli_daemon_test.go
  11. 5 6
      integration-cli/docker_cli_events_test.go
  12. 2 2
      integration-cli/docker_cli_exec_test.go
  13. 1 1
      integration-cli/docker_cli_export_import_test.go
  14. 1 1
      integration-cli/docker_cli_images_test.go
  15. 2 2
      integration-cli/docker_cli_import_test.go
  16. 1 1
      integration-cli/docker_cli_inspect_test.go
  17. 1 1
      integration-cli/docker_cli_kill_test.go
  18. 1 1
      integration-cli/docker_cli_logs_test.go
  19. 5 5
      integration-cli/docker_cli_network_unix_test.go
  20. 1 1
      integration-cli/docker_cli_plugins_test.go
  21. 1 1
      integration-cli/docker_cli_proxy_test.go
  22. 2 2
      integration-cli/docker_cli_ps_test.go
  23. 1 1
      integration-cli/docker_cli_pull_local_test.go
  24. 1 1
      integration-cli/docker_cli_pull_trusted_test.go
  25. 1 1
      integration-cli/docker_cli_push_test.go
  26. 2 2
      integration-cli/docker_cli_rename_test.go
  27. 1 1
      integration-cli/docker_cli_rmi_test.go
  28. 2 2
      integration-cli/docker_cli_run_test.go
  29. 1 1
      integration-cli/docker_cli_run_unix_test.go
  30. 1 1
      integration-cli/docker_cli_save_load_test.go
  31. 1 1
      integration-cli/docker_cli_save_load_unix_test.go
  32. 9 9
      integration-cli/docker_cli_service_logs_test.go
  33. 1 1
      integration-cli/docker_cli_start_test.go
  34. 1 1
      integration-cli/docker_cli_swarm_test.go
  35. 2 2
      integration-cli/docker_cli_top_test.go
  36. 1 1
      integration-cli/docker_cli_update_test.go
  37. 2 2
      integration-cli/docker_cli_volume_test.go
  38. 1 1
      integration-cli/docker_cli_wait_test.go
  39. 4 4
      integration-cli/docker_experimental_network_test.go
  40. 1 1
      integration-cli/docker_utils_test.go
  41. 1 1
      integration-cli/environment/clean.go
  42. 1 1
      integration-cli/environment/protect.go
  43. 1 1
      integration-cli/trust_server_test.go
  44. 5 5
      integration-cli/utils_test.go

+ 1 - 1
integration-cli/cli/build/build.go

@@ -5,7 +5,7 @@ import (
 	"strings"
 
 	"github.com/docker/docker/integration-cli/cli/build/fakecontext"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 type testingT interface {

+ 1 - 1
integration-cli/cli/cli.go

@@ -9,7 +9,7 @@ import (
 
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/docker/docker/integration-cli/environment"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/pkg/errors"
 )
 

+ 1 - 1
integration-cli/daemon/daemon.go

@@ -23,10 +23,10 @@ import (
 	"github.com/docker/docker/opts"
 	"github.com/docker/docker/pkg/ioutils"
 	"github.com/docker/docker/pkg/stringid"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/docker/go-connections/sockets"
 	"github.com/docker/go-connections/tlsconfig"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/pkg/errors"
 	"github.com/stretchr/testify/require"
 	"golang.org/x/net/context"

+ 2 - 2
integration-cli/docker_cli_attach_test.go

@@ -11,8 +11,8 @@ import (
 	"time"
 
 	"github.com/docker/docker/integration-cli/cli"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 const attachWait = 5 * time.Second
@@ -168,7 +168,7 @@ func (s *DockerSuite) TestAttachPausedContainer(c *check.C) {
 	dockerCmd(c, "pause", "test")
 
 	result := dockerCmdWithResult("attach", "test")
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		Error:    "exit status 1",
 		ExitCode: 1,
 		Err:      "You cannot attach to a paused container, unpause it first",

+ 2 - 2
integration-cli/docker_cli_build_test.go

@@ -25,8 +25,8 @@ import (
 	"github.com/docker/docker/integration-cli/cli/build/fakestorage"
 	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/stringutils"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	digest "github.com/opencontainers/go-digest"
 )
 
@@ -3866,7 +3866,7 @@ func (s *DockerSuite) TestBuildDockerfileOutsideContext(c *check.C) {
 		filepath.Join(ctx, "dockerfile2"),
 	} {
 		result := dockerCmdWithResult("build", "-t", name, "--no-cache", "-f", dockerfilePath, ".")
-		c.Assert(result, icmd.Matches, icmd.Expected{
+		result.Assert(c, icmd.Expected{
 			Err:      "must be within the build context",
 			ExitCode: 1,
 		})

+ 1 - 1
integration-cli/docker_cli_build_unix_test.go

@@ -19,9 +19,9 @@ import (
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/integration-cli/cli/build/fakecontext"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	units "github.com/docker/go-units"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {

+ 1 - 1
integration-cli/docker_cli_cp_test.go

@@ -11,8 +11,8 @@ import (
 	"strings"
 
 	"github.com/docker/docker/integration-cli/checker"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 const (

+ 1 - 1
integration-cli/docker_cli_create_test.go

@@ -14,9 +14,9 @@ import (
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/integration-cli/cli/build/fakecontext"
 	"github.com/docker/docker/pkg/stringid"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/docker/go-connections/nat"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 // Make sure we can create a simple container with some args

+ 1 - 1
integration-cli/docker_cli_daemon_plugins_test.go

@@ -9,8 +9,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/pkg/mount"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/sys/unix"
 )
 

+ 3 - 3
integration-cli/docker_cli_daemon_test.go

@@ -34,11 +34,11 @@ import (
 	"github.com/docker/docker/opts"
 	"github.com/docker/docker/pkg/mount"
 	"github.com/docker/docker/pkg/stringid"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	units "github.com/docker/go-units"
 	"github.com/docker/libnetwork/iptables"
 	"github.com/docker/libtrust"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/kr/pty"
 	"golang.org/x/sys/unix"
 )
@@ -834,7 +834,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultNetworkInvalidClusterConfig(c *chec
 
 	// Start daemon with docker0 bridge
 	result := icmd.RunCommand("ifconfig", defaultNetworkBridge)
-	c.Assert(result, icmd.Matches, icmd.Success)
+	result.Assert(c, icmd.Success)
 
 	s.d.Restart(c, fmt.Sprintf("--cluster-store=%s", discoveryBackend))
 }
@@ -2105,7 +2105,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *che
 		ctrBinary,
 		"--address", "unix:///var/run/docker/libcontainerd/docker-containerd.sock",
 		"containers", "resume", cid)
-	t.Assert(result, icmd.Matches, icmd.Success)
+	result.Assert(t, icmd.Success)
 
 	// Give time to containerd to process the command if we don't
 	// the resume event might be received after we do the inspect

+ 5 - 6
integration-cli/docker_cli_events_test.go

@@ -18,9 +18,8 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
-
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/net/context"
 )
 
@@ -70,7 +69,7 @@ func (s *DockerSuite) TestEventsUntag(c *check.C) {
 		Command: []string{dockerBinary, "events", "--since=1"},
 		Timeout: time.Millisecond * 2500,
 	})
-	c.Assert(result, icmd.Matches, icmd.Expected{Timeout: true})
+	result.Assert(c, icmd.Expected{Timeout: true})
 
 	events := strings.Split(result.Stdout(), "\n")
 	nEvents := len(events)
@@ -264,7 +263,7 @@ func (s *DockerSuite) TestEventsImageLoad(c *check.C) {
 	dockerCmd(c, "load", "-i", "saveimg.tar")
 
 	result := icmd.RunCommand("rm", "-rf", "saveimg.tar")
-	c.Assert(result, icmd.Matches, icmd.Success)
+	result.Assert(c, icmd.Success)
 
 	out, _ = dockerCmd(c, "images", "-q", "--no-trunc", myImageName)
 	imageID := strings.TrimSpace(out)
@@ -788,7 +787,7 @@ func (s *DockerSuite) TestEventsFormat(c *check.C) {
 func (s *DockerSuite) TestEventsFormatBadFunc(c *check.C) {
 	// make sure it fails immediately, without receiving any event
 	result := dockerCmdWithResult("events", "--format", "{{badFuncString .}}")
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		Error:    "exit status 64",
 		ExitCode: 64,
 		Err:      "Error parsing format: template: :1: function \"badFuncString\" not defined",
@@ -798,7 +797,7 @@ func (s *DockerSuite) TestEventsFormatBadFunc(c *check.C) {
 func (s *DockerSuite) TestEventsFormatBadField(c *check.C) {
 	// make sure it fails immediately, without receiving any event
 	result := dockerCmdWithResult("events", "--format", "{{.badFieldString}}")
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		Error:    "exit status 64",
 		ExitCode: 64,
 		Err:      "Error parsing format: template: :1:2: executing \"\" at <.badFieldString>: can't evaluate field badFieldString in type *events.Message",

+ 2 - 2
integration-cli/docker_cli_exec_test.go

@@ -18,8 +18,8 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/net/context"
 )
 
@@ -133,7 +133,7 @@ func (s *DockerSuite) TestExecExitStatus(c *check.C) {
 	runSleepingContainer(c, "-d", "--name", "top")
 
 	result := icmd.RunCommand(dockerBinary, "exec", "top", "sh", "-c", "exit 23")
-	c.Assert(result, icmd.Matches, icmd.Expected{ExitCode: 23, Error: "exit status 23"})
+	result.Assert(c, icmd.Expected{ExitCode: 23, Error: "exit status 23"})
 }
 
 func (s *DockerSuite) TestExecPausedContainer(c *check.C) {

+ 1 - 1
integration-cli/docker_cli_export_import_test.go

@@ -5,8 +5,8 @@ import (
 	"strings"
 
 	"github.com/docker/docker/integration-cli/checker"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 // export an image and try to import it into a new one

+ 1 - 1
integration-cli/docker_cli_images_test.go

@@ -13,8 +13,8 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/pkg/stringid"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestImagesEnsureImageIsListed(c *check.C) {

+ 2 - 2
integration-cli/docker_cli_import_test.go

@@ -11,8 +11,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestImportDisplay(c *check.C) {
@@ -138,5 +138,5 @@ func (s *DockerSuite) TestImportWithQuotedChanges(c *check.C) {
 	image := strings.TrimSpace(result.Stdout())
 
 	result = cli.DockerCmd(c, "run", "--rm", image, "true")
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: icmd.None})
+	result.Assert(c, icmd.Expected{Out: icmd.None})
 }

+ 1 - 1
integration-cli/docker_cli_inspect_test.go

@@ -11,8 +11,8 @@ import (
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/integration-cli/checker"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func checkValidGraphDriver(c *check.C, name string) {

+ 1 - 1
integration-cli/docker_cli_kill_test.go

@@ -8,8 +8,8 @@ import (
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/net/context"
 )
 

+ 1 - 1
integration-cli/docker_cli_logs_test.go

@@ -11,8 +11,8 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/pkg/jsonlog"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 // This used to work, it test a log of PageSize-1 (gh#4851)

+ 5 - 5
integration-cli/docker_cli_network_unix_test.go

@@ -20,7 +20,6 @@ import (
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/docker/docker/pkg/stringid"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/docker/docker/runconfig"
 	"github.com/docker/libnetwork/driverapi"
 	remoteapi "github.com/docker/libnetwork/drivers/remote/api"
@@ -28,6 +27,7 @@ import (
 	remoteipam "github.com/docker/libnetwork/ipams/remote/api"
 	"github.com/docker/libnetwork/netlabel"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/vishvananda/netlink"
 	"golang.org/x/sys/unix"
 )
@@ -482,7 +482,7 @@ func (s *DockerSuite) TestDockerNetworkInspectWithID(c *check.C) {
 
 func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) {
 	result := dockerCmdWithResult("network", "inspect", "host", "none")
-	c.Assert(result, icmd.Matches, icmd.Success)
+	result.Assert(c, icmd.Success)
 
 	networkResources := []types.NetworkResource{}
 	err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
@@ -494,7 +494,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
 	// non-existent network was not at the beginning of the inspect list
 	// This should print an error, return an exitCode 1 and print the host network
 	result := dockerCmdWithResult("network", "inspect", "host", "nonexistent")
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		ExitCode: 1,
 		Err:      "Error: No such network: nonexistent",
 		Out:      "host",
@@ -508,7 +508,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
 	// Only one non-existent network to inspect
 	// Should print an error and return an exitCode, nothing else
 	result = dockerCmdWithResult("network", "inspect", "nonexistent")
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		ExitCode: 1,
 		Err:      "Error: No such network: nonexistent",
 		Out:      "[]",
@@ -517,7 +517,7 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
 	// non-existent network was at the beginning of the inspect list
 	// Should not fail fast, and still print host network but print an error
 	result = dockerCmdWithResult("network", "inspect", "nonexistent", "host")
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		ExitCode: 1,
 		Err:      "Error: No such network: nonexistent",
 		Out:      "host",

+ 1 - 1
integration-cli/docker_cli_plugins_test.go

@@ -16,8 +16,8 @@ import (
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/docker/docker/integration-cli/fixtures/plugin"
 	"github.com/docker/docker/integration-cli/request"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/net/context"
 )
 

+ 1 - 1
integration-cli/docker_cli_proxy_test.go

@@ -5,8 +5,8 @@ import (
 	"strings"
 
 	"github.com/docker/docker/integration-cli/checker"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestCLIProxyDisableProxyUnixSock(c *check.C) {

+ 2 - 2
integration-cli/docker_cli_ps_test.go

@@ -14,8 +14,8 @@ import (
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/pkg/stringid"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestPsListContainersBase(c *check.C) {
@@ -206,7 +206,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
 	c.Assert(containerOut, checker.Equals, secondID)
 
 	result := cli.Docker(cli.Args("ps", "-a", "-q", "--filter=status=rubbish"), cli.WithTimeout(time.Second*60))
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		ExitCode: 1,
 		Err:      "Invalid filter 'status=rubbish'",
 	})

+ 1 - 1
integration-cli/docker_cli_pull_local_test.go

@@ -15,8 +15,8 @@ import (
 	"github.com/docker/distribution/manifest/schema2"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/opencontainers/go-digest"
 )
 

+ 1 - 1
integration-cli/docker_cli_pull_trusted_test.go

@@ -7,8 +7,8 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerTrustSuite) TestTrustedPull(c *check.C) {

+ 1 - 1
integration-cli/docker_cli_push_test.go

@@ -16,8 +16,8 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 // Pushing an image to a private registry.

+ 2 - 2
integration-cli/docker_cli_rename_test.go

@@ -5,8 +5,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/pkg/stringid"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestRenameStoppedContainer(c *check.C) {
@@ -63,7 +63,7 @@ func (s *DockerSuite) TestRenameCheckNames(c *check.C) {
 	c.Assert(name, checker.Equals, "/"+newName, check.Commentf("Failed to rename container %s", name))
 
 	result := dockerCmdWithResult("inspect", "-f={{.Name}}", "--type=container", "first_name")
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		ExitCode: 1,
 		Err:      "No such container: first_name",
 	})

+ 1 - 1
integration-cli/docker_cli_rmi_test.go

@@ -9,8 +9,8 @@ import (
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/pkg/stringid"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {

+ 2 - 2
integration-cli/docker_cli_run_test.go

@@ -28,12 +28,12 @@ import (
 	"github.com/docker/docker/pkg/mount"
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/docker/docker/pkg/stringutils"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/docker/docker/runconfig"
 	"github.com/docker/go-connections/nat"
 	"github.com/docker/libnetwork/resolvconf"
 	"github.com/docker/libnetwork/types"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	libcontainerUser "github.com/opencontainers/runc/libcontainer/user"
 )
 
@@ -1798,7 +1798,7 @@ func (s *DockerSuite) TestRunInteractiveWithRestartPolicy(c *check.C) {
 	}()
 
 	result = icmd.WaitOnCmd(60*time.Second, result)
-	c.Assert(result, icmd.Matches, icmd.Expected{ExitCode: 11})
+	result.Assert(c, icmd.Expected{ExitCode: 11})
 }
 
 // Test for #2267

+ 1 - 1
integration-cli/docker_cli_run_unix_test.go

@@ -23,8 +23,8 @@ import (
 	"github.com/docker/docker/pkg/mount"
 	"github.com/docker/docker/pkg/parsers"
 	"github.com/docker/docker/pkg/sysinfo"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/kr/pty"
 )
 

+ 1 - 1
integration-cli/docker_cli_save_load_test.go

@@ -17,8 +17,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	digest "github.com/opencontainers/go-digest"
 )
 

+ 1 - 1
integration-cli/docker_cli_save_load_unix_test.go

@@ -13,8 +13,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/kr/pty"
 )
 

+ 9 - 9
integration-cli/docker_cli_service_logs_test.go

@@ -12,8 +12,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/daemon"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 type logMessage struct {
@@ -287,7 +287,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTTY(c *check.C) {
 	result = icmd.RunCmd(cmd)
 	// for some reason there is carriage return in the output. i think this is
 	// just expected.
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: "out\r\nerr\r\n"})
+	result.Assert(c, icmd.Expected{Out: "out\r\nerr\r\n"})
 }
 
 func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
@@ -307,7 +307,7 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
 	))
 
 	// confirm that the command succeeded
-	c.Assert(result, icmd.Matches, icmd.Expected{})
+	result.Assert(c, icmd.Expected{})
 	// get the service id
 	id := strings.TrimSpace(result.Stdout())
 	c.Assert(id, checker.Not(checker.Equals), "")
@@ -322,9 +322,9 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
 	containerID := strings.TrimSpace(result.Stdout())
 	c.Assert(containerID, checker.Not(checker.Equals), "")
 	result = icmd.RunCmd(d.Command("stop", containerID))
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: containerID})
+	result.Assert(c, icmd.Expected{Out: containerID})
 	result = icmd.RunCmd(d.Command("rm", containerID))
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: containerID})
+	result.Assert(c, icmd.Expected{Out: containerID})
 
 	// run logs. use tail 2 to make sure we don't try to get a bunch of logs
 	// somehow and slow down execution time
@@ -336,7 +336,7 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
 	// then, assert that the result matches expected. if the command timed out,
 	// if the command is timed out, result.Timeout will be true, but the
 	// Expected defaults to false
-	c.Assert(result, icmd.Matches, icmd.Expected{})
+	result.Assert(c, icmd.Expected{})
 }
 
 func (s *DockerSwarmSuite) TestServiceLogsDetails(c *check.C) {
@@ -376,12 +376,12 @@ func (s *DockerSwarmSuite) TestServiceLogsDetails(c *check.C) {
 	// in this case, we should get details and we should get log message, but
 	// there will also be context as details (which will fall after the detail
 	// we inserted in alphabetical order
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: "asdf=test1"})
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: "LogLine"})
+	result.Assert(c, icmd.Expected{Out: "asdf=test1"})
+	result.Assert(c, icmd.Expected{Out: "LogLine"})
 
 	// call service logs with details. this time, don't pass raw
 	result = icmd.RunCmd(d.Command("service", "logs", "--details", id))
 	// in this case, we should get details space logmessage as well. the context
 	// is part of the pretty part of the logline
-	c.Assert(result, icmd.Matches, icmd.Expected{Out: "asdf=test1 LogLine"})
+	result.Assert(c, icmd.Expected{Out: "asdf=test1 LogLine"})
 }

+ 1 - 1
integration-cli/docker_cli_start_test.go

@@ -7,8 +7,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 // Regression test for https://github.com/docker/docker/issues/7843

+ 1 - 1
integration-cli/docker_cli_swarm_test.go

@@ -22,12 +22,12 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/daemon"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/docker/libnetwork/driverapi"
 	"github.com/docker/libnetwork/ipamapi"
 	remoteipam "github.com/docker/libnetwork/ipams/remote/api"
 	"github.com/go-check/check"
 	"github.com/gotestyourself/gotestyourself/fs"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/vishvananda/netlink"
 	"golang.org/x/net/context"
 )

+ 2 - 2
integration-cli/docker_cli_top_test.go

@@ -4,8 +4,8 @@ import (
 	"strings"
 
 	"github.com/docker/docker/integration-cli/checker"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
@@ -20,7 +20,7 @@ func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
 		expected = icmd.Expected{Out: "PID"}
 	}
 	result := dockerCmdWithResult("top", cleanedContainerID, "-o", "pid")
-	c.Assert(result, icmd.Matches, expected)
+	result.Assert(c, expected)
 }
 
 func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {

+ 1 - 1
integration-cli/docker_cli_update_test.go

@@ -6,8 +6,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 func (s *DockerSuite) TestUpdateRestartPolicy(c *check.C) {

+ 2 - 2
integration-cli/docker_cli_volume_test.go

@@ -14,8 +14,8 @@ import (
 	"github.com/docker/docker/client"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/net/context"
 )
 
@@ -58,7 +58,7 @@ func (s *DockerSuite) TestVolumeCLIInspectMulti(c *check.C) {
 	dockerCmd(c, "volume", "create", "test3")
 
 	result := dockerCmdWithResult("volume", "inspect", "--format={{ .Name }}", "test1", "test2", "doesnotexist", "test3")
-	c.Assert(result, icmd.Matches, icmd.Expected{
+	result.Assert(c, icmd.Expected{
 		ExitCode: 1,
 		Err:      "No such volume: doesnotexist",
 	})

+ 1 - 1
integration-cli/docker_cli_wait_test.go

@@ -7,8 +7,8 @@ import (
 	"time"
 
 	"github.com/docker/docker/integration-cli/checker"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 // non-blocking wait with 0 exit code

+ 4 - 4
integration-cli/docker_experimental_network_test.go

@@ -9,8 +9,8 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/pkg/parsers/kernel"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 // ensure Kernel version is >= v3.9 for macvlan support
@@ -382,7 +382,7 @@ func (s *DockerSuite) TestDockerNetworkMacVlanBridgeInternalMode(c *check.C) {
 
 	// access outside of the network should fail
 	result := cli.Docker(cli.Args("exec", "first", "ping", "-c", "1", "-w", "1", "8.8.8.8"), cli.WithTimeout(time.Second))
-	c.Assert(result, icmd.Matches, icmd.Expected{Timeout: true})
+	result.Assert(c, icmd.Expected{Timeout: true})
 
 	// intra-network communications should succeed
 	cli.DockerCmd(c, "exec", "second", "ping", "-c", "1", "first")
@@ -421,7 +421,7 @@ func (s *DockerSuite) TestDockerNetworkIpvlanL2InternalMode(c *check.C) {
 
 	// access outside of the network should fail
 	result := cli.Docker(cli.Args("exec", "first", "ping", "-c", "1", "-w", "1", "8.8.8.8"), cli.WithTimeout(time.Second))
-	c.Assert(result, icmd.Matches, icmd.Expected{Timeout: true})
+	result.Assert(c, icmd.Expected{Timeout: true})
 	// intra-network communications should succeed
 	cli.DockerCmd(c, "exec", "second", "ping", "-c", "1", "first")
 }
@@ -461,7 +461,7 @@ func (s *DockerSuite) TestDockerNetworkIpvlanL3InternalMode(c *check.C) {
 
 	// access outside of the network should fail
 	result := cli.Docker(cli.Args("exec", "first", "ping", "-c", "1", "-w", "1", "8.8.8.8"), cli.WithTimeout(time.Second))
-	c.Assert(result, icmd.Matches, icmd.Expected{Timeout: true})
+	result.Assert(c, icmd.Expected{Timeout: true})
 	// intra-network communications should succeed
 	cli.DockerCmd(c, "exec", "second", "ping", "-c", "1", "first")
 }

+ 1 - 1
integration-cli/docker_utils_test.go

@@ -21,8 +21,8 @@ import (
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/docker/docker/integration-cli/registry"
 	"github.com/docker/docker/integration-cli/request"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/net/context"
 )
 

+ 1 - 1
integration-cli/environment/clean.go

@@ -7,7 +7,7 @@ import (
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/client"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"golang.org/x/net/context"
 )
 

+ 1 - 1
integration-cli/environment/protect.go

@@ -4,7 +4,7 @@ import (
 	"strings"
 
 	"github.com/docker/docker/integration-cli/fixtures/load"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 type protectedElements struct {

+ 1 - 1
integration-cli/trust_server_test.go

@@ -18,9 +18,9 @@ import (
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/fixtures/plugin"
 	"github.com/docker/docker/integration-cli/request"
-	icmd "github.com/docker/docker/pkg/testutil/cmd"
 	"github.com/docker/go-connections/tlsconfig"
 	"github.com/go-check/check"
+	"github.com/gotestyourself/gotestyourself/icmd"
 )
 
 var notaryBinary = "notary"

+ 5 - 5
integration-cli/utils_test.go

@@ -8,7 +8,7 @@ import (
 	"strings"
 
 	"github.com/docker/docker/pkg/stringutils"
-	"github.com/docker/docker/pkg/testutil/cmd"
+	"github.com/gotestyourself/gotestyourself/icmd"
 	"github.com/pkg/errors"
 )
 
@@ -20,15 +20,15 @@ func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) {
 }
 
 // TODO: update code to call cmd.RunCmd directly, and remove this function
-// Deprecated: use pkg/testutil/cmd instead
+// Deprecated: use gotestyourself/gotestyourself/icmd
 func runCommandWithOutput(execCmd *exec.Cmd) (string, int, error) {
-	result := cmd.RunCmd(transformCmd(execCmd))
+	result := icmd.RunCmd(transformCmd(execCmd))
 	return result.Combined(), result.ExitCode, result.Error
 }
 
 // Temporary shim for migrating commands to the new function
-func transformCmd(execCmd *exec.Cmd) cmd.Cmd {
-	return cmd.Cmd{
+func transformCmd(execCmd *exec.Cmd) icmd.Cmd {
+	return icmd.Cmd{
 		Command: execCmd.Args,
 		Env:     execCmd.Env,
 		Dir:     execCmd.Dir,