Explorar o código

Merge pull request #15045 from cpuguy83/fix_dockercmdwitherror

Don't pass check.C to dockerCmdWithError
Doug Davis %!s(int64=10) %!d(string=hai) anos
pai
achega
8c9cd0418d

+ 1 - 1
integration-cli/docker_api_containers_test.go

@@ -329,7 +329,7 @@ func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
 	c.Assert(err, check.IsNil)
 
 	// Now remove without `-f` and make sure we are still pulling stats
-	_, _, err = dockerCmdWithError(c, "rm", id)
+	_, _, err = dockerCmdWithError("rm", id)
 	c.Assert(err, check.Not(check.IsNil), check.Commentf("rm should have failed but didn't"))
 	_, err = buf.ReadTimeout(b, 2*time.Second)
 	c.Assert(err, check.IsNil)

+ 6 - 6
integration-cli/docker_cli_build_test.go

@@ -4129,7 +4129,7 @@ func (s *DockerSuite) TestBuildFromGITwithF(c *check.C) {
 	}
 	defer git.Close()
 
-	out, _, err := dockerCmdWithError(c, "build", "-t", name, "--no-cache", "-f", "myApp/myDockerfile", git.RepoURL)
+	out, _, err := dockerCmdWithError("build", "-t", name, "--no-cache", "-f", "myApp/myDockerfile", git.RepoURL)
 	if err != nil {
 		c.Fatalf("Error on build. Out: %s\nErr: %v", out, err)
 	}
@@ -4364,7 +4364,7 @@ func (s *DockerSuite) TestBuildEntrypointInheritance(c *check.C) {
 		c.Fatal(err)
 	}
 
-	if _, status, _ := dockerCmdWithError(c, "run", "parent"); status != 130 {
+	if _, status, _ := dockerCmdWithError("run", "parent"); status != 130 {
 		c.Fatalf("expected exit code 130 but received %d", status)
 	}
 
@@ -4375,7 +4375,7 @@ func (s *DockerSuite) TestBuildEntrypointInheritance(c *check.C) {
 		c.Fatal(err)
 	}
 
-	if _, status, _ := dockerCmdWithError(c, "run", "child"); status != 5 {
+	if _, status, _ := dockerCmdWithError("run", "child"); status != 5 {
 		c.Fatalf("expected exit code 5 but received %d", status)
 	}
 
@@ -4471,7 +4471,7 @@ func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) {
 		c.Fatal(err)
 	}
 
-	if _, _, err := dockerCmdWithError(c, "run", "--rm", name); err == nil {
+	if _, _, err := dockerCmdWithError("run", "--rm", name); err == nil {
 		c.Fatal("The image was not supposed to be able to run")
 	}
 
@@ -5017,7 +5017,7 @@ func (s *DockerSuite) TestBuildDockerfileOutsideContext(c *check.C) {
 		filepath.Join(ctx, "dockerfile1"),
 		filepath.Join(ctx, "dockerfile2"),
 	} {
-		out, _, err := dockerCmdWithError(c, "build", "-t", name, "--no-cache", "-f", dockerfilePath, ".")
+		out, _, err := dockerCmdWithError("build", "-t", name, "--no-cache", "-f", dockerfilePath, ".")
 		if err == nil {
 			c.Fatalf("Expected error with %s. Out: %s", dockerfilePath, out)
 		}
@@ -5031,7 +5031,7 @@ func (s *DockerSuite) TestBuildDockerfileOutsideContext(c *check.C) {
 
 	// Path to Dockerfile should be resolved relative to working directory, not relative to context.
 	// There is a Dockerfile in the context, but since there is no Dockerfile in the current directory, the following should fail
-	out, _, err := dockerCmdWithError(c, "build", "-t", name, "--no-cache", "-f", "Dockerfile", ctx)
+	out, _, err := dockerCmdWithError("build", "-t", name, "--no-cache", "-f", "Dockerfile", ctx)
 	if err == nil {
 		c.Fatalf("Expected error. Out: %s", out)
 	}

+ 4 - 4
integration-cli/docker_cli_by_digest_test.go

@@ -26,7 +26,7 @@ func setupImageWithTag(c *check.C, tag string) (string, error) {
 
 	// tag the image to upload it to the private registry
 	repoAndTag := utils.ImageReference(repoName, tag)
-	if out, _, err := dockerCmdWithError(c, "commit", containerName, repoAndTag); err != nil {
+	if out, _, err := dockerCmdWithError("commit", containerName, repoAndTag); err != nil {
 		return "", fmt.Errorf("image tagging failed: %s, %v", out, err)
 	}
 
@@ -36,13 +36,13 @@ func setupImageWithTag(c *check.C, tag string) (string, error) {
 	}
 
 	// push the image
-	out, _, err := dockerCmdWithError(c, "push", repoAndTag)
+	out, _, err := dockerCmdWithError("push", repoAndTag)
 	if err != nil {
 		return "", fmt.Errorf("pushing the image to the private registry has failed: %s, %v", out, err)
 	}
 
 	// delete our local repo that we previously tagged
-	if rmiout, _, err := dockerCmdWithError(c, "rmi", repoAndTag); err != nil {
+	if rmiout, _, err := dockerCmdWithError("rmi", repoAndTag); err != nil {
 		return "", fmt.Errorf("error deleting images prior to real test: %s, %v", rmiout, err)
 	}
 
@@ -103,7 +103,7 @@ func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
 func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
 	// pull from the registry using the <name>@<digest> reference
 	imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
-	out, _, err := dockerCmdWithError(c, "pull", imageReference)
+	out, _, err := dockerCmdWithError("pull", imageReference)
 	if err == nil || !strings.Contains(out, "manifest unknown") {
 		c.Fatalf("expected non-zero exit status and correct error message when pulling non-existing image: %s", out)
 	}

+ 1 - 1
integration-cli/docker_cli_daemon_test.go

@@ -1369,7 +1369,7 @@ func pingContainers(c *check.C, d *Daemon, expectFailure bool) {
 	args = append(dargs, "run", "--rm", "--link", "container1:alias1", "busybox", "sh", "-c")
 	pingCmd := "ping -c 1 %s -W 1"
 	args = append(args, fmt.Sprintf(pingCmd, "alias1"))
-	_, _, err := dockerCmdWithError(c, args...)
+	_, _, err := dockerCmdWithError(args...)
 
 	if expectFailure {
 		c.Assert(err, check.NotNil)

+ 1 - 1
integration-cli/docker_cli_diff_test.go

@@ -82,7 +82,7 @@ func (s *DockerSuite) TestDiffEnsureOnlyKmsgAndPtmx(c *check.C) {
 
 // https://github.com/docker/docker/pull/14381#discussion_r33859347
 func (s *DockerSuite) TestDiffEmptyArgClientError(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "diff", "")
+	out, _, err := dockerCmdWithError("diff", "")
 	c.Assert(err, check.NotNil)
 	c.Assert(strings.TrimSpace(out), check.Equals, "Container name cannot be empty")
 }

+ 1 - 1
integration-cli/docker_cli_events_test.go

@@ -75,7 +75,7 @@ func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) {
 
 	out, _ := dockerCmd(c, "images", "-q")
 	image := strings.Split(out, "\n")[0]
-	if _, _, err := dockerCmdWithError(c, "run", "--name", "testeventdie", image, "blerg"); err == nil {
+	if _, _, err := dockerCmdWithError("run", "--name", "testeventdie", image, "blerg"); err == nil {
 		c.Fatalf("Container run with command blerg should have failed, but it did not")
 	}
 

+ 2 - 2
integration-cli/docker_cli_exec_test.go

@@ -148,7 +148,7 @@ func (s *DockerSuite) TestExecPausedContainer(c *check.C) {
 	ContainerID := strings.TrimSpace(out)
 
 	dockerCmd(c, "pause", "testing")
-	out, _, err := dockerCmdWithError(c, "exec", "-i", "-t", ContainerID, "echo", "hello")
+	out, _, err := dockerCmdWithError("exec", "-i", "-t", ContainerID, "echo", "hello")
 	if err == nil {
 		c.Fatal("container should fail to exec new command if it is paused")
 	}
@@ -268,7 +268,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) {
 	for i := 0; i < 5; i++ {
 		wg.Add(1)
 		go func() {
-			out, _, err := dockerCmdWithError(c, "exec", "testing", "cat", "/proc/self/cgroup")
+			out, _, err := dockerCmdWithError("exec", "testing", "cat", "/proc/self/cgroup")
 			if err != nil {
 				errChan <- err
 				return

+ 1 - 1
integration-cli/docker_cli_history_test.go

@@ -66,7 +66,7 @@ func (s *DockerSuite) TestHistoryExistentImage(c *check.C) {
 }
 
 func (s *DockerSuite) TestHistoryNonExistentImage(c *check.C) {
-	_, _, err := dockerCmdWithError(c, "history", "testHistoryNonExistentImage")
+	_, _, err := dockerCmdWithError("history", "testHistoryNonExistentImage")
 	if err == nil {
 		c.Fatal("history on a non-existent image should fail.")
 	}

+ 1 - 1
integration-cli/docker_cli_images_test.go

@@ -54,7 +54,7 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
 }
 
 func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "images", "-f", "FOO=123")
+	out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
 	if err == nil || !strings.Contains(out, "Invalid filter") {
 		c.Fatalf("error should occur when listing images with invalid filter name FOO, %s", out)
 	}

+ 2 - 2
integration-cli/docker_cli_import_test.go

@@ -34,7 +34,7 @@ func (s *DockerSuite) TestImportDisplay(c *check.C) {
 }
 
 func (s *DockerSuite) TestImportBadURL(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "import", "http://nourl/bad")
+	out, _, err := dockerCmdWithError("import", "http://nourl/bad")
 	if err == nil {
 		c.Fatal("import was supposed to fail but didn't")
 	}
@@ -73,7 +73,7 @@ func (s *DockerSuite) TestImportFile(c *check.C) {
 }
 
 func (s *DockerSuite) TestImportFileNonExistentFile(c *check.C) {
-	_, exitCode, err := dockerCmdWithError(c, "import", "example.com/myImage.tar")
+	_, exitCode, err := dockerCmdWithError("import", "example.com/myImage.tar")
 	if exitCode == 0 || err == nil {
 		c.Fatalf("import non-existing file must failed")
 	}

+ 5 - 5
integration-cli/docker_cli_inspect_test.go

@@ -55,7 +55,7 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
 	dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top")
 
 	formatStr := fmt.Sprintf("--format='{{.State.Running}}'")
-	out, exitCode, err := dockerCmdWithError(c, "inspect", "--type=container", formatStr, "busybox")
+	out, exitCode, err := dockerCmdWithError("inspect", "--type=container", formatStr, "busybox")
 	if exitCode != 0 || err != nil {
 		c.Fatalf("failed to inspect container: %s, %v", out, err)
 	}
@@ -73,7 +73,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
 
 	dockerCmd(c, "run", "-d", "busybox", "true")
 
-	_, exitCode, err := dockerCmdWithError(c, "inspect", "--type=container", "busybox")
+	_, exitCode, err := dockerCmdWithError("inspect", "--type=container", "busybox")
 	if exitCode == 0 || err == nil {
 		c.Fatalf("docker inspect should have failed, as there is no container named busybox")
 	}
@@ -87,7 +87,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
 
 	dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
 
-	out, exitCode, err := dockerCmdWithError(c, "inspect", "--type=image", "busybox")
+	out, exitCode, err := dockerCmdWithError("inspect", "--type=image", "busybox")
 	if exitCode != 0 || err != nil {
 		c.Fatalf("failed to inspect image: %s, %v", out, err)
 	}
@@ -104,7 +104,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
 
 	dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
 
-	out, exitCode, err := dockerCmdWithError(c, "inspect", "--type=foobar", "busybox")
+	out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox")
 	if exitCode != 0 || err != nil {
 		if !strings.Contains(out, "not a valid value for --type") {
 			c.Fatalf("failed to inspect image: %s, %v", out, err)
@@ -124,7 +124,7 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
 
 	//now see if the size turns out to be the same
 	formatStr := fmt.Sprintf("--format='{{eq .Size %d}}'", size)
-	out, exitCode, err := dockerCmdWithError(c, "inspect", formatStr, imageTest)
+	out, exitCode, err := dockerCmdWithError("inspect", formatStr, imageTest)
 	if exitCode != 0 || err != nil {
 		c.Fatalf("failed to inspect image: %s, %v", out, err)
 	}

+ 3 - 3
integration-cli/docker_cli_kill_test.go

@@ -25,7 +25,7 @@ func (s *DockerSuite) TestKillofStoppedContainer(c *check.C) {
 
 	dockerCmd(c, "stop", cleanedContainerID)
 
-	_, _, err := dockerCmdWithError(c, "kill", "-s", "30", cleanedContainerID)
+	_, _, err := dockerCmdWithError("kill", "-s", "30", cleanedContainerID)
 	c.Assert(err, check.Not(check.IsNil), check.Commentf("Container %s is not running", cleanedContainerID))
 }
 
@@ -61,7 +61,7 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
 	cid := strings.TrimSpace(out)
 	c.Assert(waitRun(cid), check.IsNil)
 
-	out, _, err := dockerCmdWithError(c, "kill", "-s", "0", cid)
+	out, _, err := dockerCmdWithError("kill", "-s", "0", cid)
 	c.Assert(err, check.NotNil)
 	if !strings.ContainsAny(out, "Invalid signal: 0") {
 		c.Fatal("Kill with an invalid signal didn't error out correctly")
@@ -76,7 +76,7 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
 	cid = strings.TrimSpace(out)
 	c.Assert(waitRun(cid), check.IsNil)
 
-	out, _, err = dockerCmdWithError(c, "kill", "-s", "SIG42", cid)
+	out, _, err = dockerCmdWithError("kill", "-s", "SIG42", cid)
 	c.Assert(err, check.NotNil)
 	if !strings.ContainsAny(out, "Invalid signal: SIG42") {
 		c.Fatal("Kill with an invalid signal error out correctly")

+ 2 - 2
integration-cli/docker_cli_links_test.go

@@ -11,7 +11,7 @@ import (
 
 func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
 
-	_, exitCode, err := dockerCmdWithError(c, "run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
+	_, exitCode, err := dockerCmdWithError("run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
 
 	if exitCode == 0 {
 		c.Fatal("run ping did not fail")
@@ -24,7 +24,7 @@ func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
 // Test for appropriate error when calling --link with an invalid target container
 func (s *DockerSuite) TestLinksInvalidContainerTarget(c *check.C) {
 
-	out, _, err := dockerCmdWithError(c, "run", "--link", "bogus:alias", "busybox", "true")
+	out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true")
 
 	if err == nil {
 		c.Fatal("an invalid container target should produce an error")

+ 1 - 1
integration-cli/docker_cli_links_unix_test.go

@@ -34,7 +34,7 @@ func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) {
 
 func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
 	dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top")
-	out, _, err := dockerCmdWithError(c, "run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
+	out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
 	if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") {
 		c.Fatalf("Running container linking to a container with --net host should have failed: %s", out)
 	}

+ 2 - 2
integration-cli/docker_cli_port_unix_test.go

@@ -25,7 +25,7 @@ func (s *DockerSuite) TestPortHostBinding(c *check.C) {
 
 	dockerCmd(c, "rm", "-f", firstID)
 
-	if _, _, err := dockerCmdWithError(c, "run", "--net=host", "busybox",
+	if _, _, err := dockerCmdWithError("run", "--net=host", "busybox",
 		"nc", "localhost", "9876"); err == nil {
 		c.Error("Port is still bound after the Container is removed")
 	}
@@ -49,7 +49,7 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) {
 
 	dockerCmd(c, "rm", "-f", firstID)
 
-	if _, _, err = dockerCmdWithError(c, "run", "--net=host", "busybox",
+	if _, _, err = dockerCmdWithError("run", "--net=host", "busybox",
 		"nc", "localhost", strings.TrimSpace(exposedPort)); err == nil {
 		c.Error("Port is still bound after the Container is removed")
 	}

+ 2 - 2
integration-cli/docker_cli_ps_test.go

@@ -337,7 +337,7 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
 		c.Fatal(err)
 	}
 
-	if out, _, err := dockerCmdWithError(c, "run", "--name", "nonzero1", "busybox", "false"); err == nil {
+	if out, _, err := dockerCmdWithError("run", "--name", "nonzero1", "busybox", "false"); err == nil {
 		c.Fatal("Should fail.", out, err)
 	}
 
@@ -346,7 +346,7 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
 		c.Fatal(err)
 	}
 
-	if out, _, err := dockerCmdWithError(c, "run", "--name", "nonzero2", "busybox", "false"); err == nil {
+	if out, _, err := dockerCmdWithError("run", "--name", "nonzero2", "busybox", "false"); err == nil {
 		c.Fatal("Should fail.", out, err)
 	}
 	secondNonZero, err := getIDByName("nonzero2")

+ 6 - 6
integration-cli/docker_cli_pull_test.go

@@ -34,7 +34,7 @@ func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) {
 	dockerCmd(c, "pull", repos[0])
 	dockerCmd(c, "inspect", repos[0])
 	for _, repo := range repos[1:] {
-		if _, _, err := dockerCmdWithError(c, "inspect", repo); err == nil {
+		if _, _, err := dockerCmdWithError("inspect", repo); err == nil {
 			c.Fatalf("Image %v shouldn't have been pulled down", repo)
 		}
 	}
@@ -51,7 +51,7 @@ func (s *DockerSuite) TestPullVerified(c *check.C) {
 
 	// pull it
 	expected := "The image you are pulling has been verified"
-	if out, exitCode, err := dockerCmdWithError(c, "pull", verifiedName); err != nil || !strings.Contains(out, expected) {
+	if out, exitCode, err := dockerCmdWithError("pull", verifiedName); err != nil || !strings.Contains(out, expected) {
 		if err != nil || exitCode != 0 {
 			c.Skip(fmt.Sprintf("pulling the '%s' image from the registry has failed: %v", verifiedName, err))
 		}
@@ -59,7 +59,7 @@ func (s *DockerSuite) TestPullVerified(c *check.C) {
 	}
 
 	// pull it again
-	if out, exitCode, err := dockerCmdWithError(c, "pull", verifiedName); err != nil || strings.Contains(out, expected) {
+	if out, exitCode, err := dockerCmdWithError("pull", verifiedName); err != nil || strings.Contains(out, expected) {
 		if err != nil || exitCode != 0 {
 			c.Skip(fmt.Sprintf("pulling the '%s' image from the registry has failed: %v", verifiedName, err))
 		}
@@ -80,7 +80,7 @@ func (s *DockerSuite) TestPullNonExistingImage(c *check.C) {
 	testRequires(c, Network)
 
 	name := "sadfsadfasdf"
-	out, _, err := dockerCmdWithError(c, "pull", name)
+	out, _, err := dockerCmdWithError("pull", name)
 
 	if err == nil || !strings.Contains(out, fmt.Sprintf("Error: image library/%s:latest not found", name)) {
 		c.Fatalf("expected non-zero exit status when pulling non-existing image: %s", out)
@@ -98,7 +98,7 @@ func (s *DockerSuite) TestPullImageOfficialNames(c *check.C) {
 		"index.docker.io/library/hello-world",
 	}
 	for _, name := range names {
-		out, exitCode, err := dockerCmdWithError(c, "pull", name)
+		out, exitCode, err := dockerCmdWithError("pull", name)
 		if err != nil || exitCode != 0 {
 			c.Errorf("pulling the '%s' image from the registry has failed: %s", name, err)
 			continue
@@ -115,7 +115,7 @@ func (s *DockerSuite) TestPullImageOfficialNames(c *check.C) {
 func (s *DockerSuite) TestPullScratchNotAllowed(c *check.C) {
 	testRequires(c, Network)
 
-	out, exitCode, err := dockerCmdWithError(c, "pull", "scratch")
+	out, exitCode, err := dockerCmdWithError("pull", "scratch")
 	if err == nil {
 		c.Fatal("expected pull of scratch to fail, but it didn't")
 	}

+ 5 - 5
integration-cli/docker_cli_push_test.go

@@ -23,7 +23,7 @@ func (s *DockerRegistrySuite) TestPushBusyboxImage(c *check.C) {
 
 // pushing an image without a prefix should throw an error
 func (s *DockerSuite) TestPushUnprefixedRepo(c *check.C) {
-	if out, _, err := dockerCmdWithError(c, "push", "busybox"); err == nil {
+	if out, _, err := dockerCmdWithError("push", "busybox"); err == nil {
 		c.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
 	}
 }
@@ -32,7 +32,7 @@ func (s *DockerRegistrySuite) TestPushUntagged(c *check.C) {
 	repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
 
 	expected := "Repository does not exist"
-	if out, _, err := dockerCmdWithError(c, "push", repoName); err == nil {
+	if out, _, err := dockerCmdWithError("push", repoName); err == nil {
 		c.Fatalf("pushing the image to the private registry should have failed: output %q", out)
 	} else if !strings.Contains(out, expected) {
 		c.Fatalf("pushing the image failed with an unexpected message: expected %q, got %q", expected, out)
@@ -44,7 +44,7 @@ func (s *DockerRegistrySuite) TestPushBadTag(c *check.C) {
 
 	expected := "does not exist"
 
-	if out, _, err := dockerCmdWithError(c, "push", repoName); err == nil {
+	if out, _, err := dockerCmdWithError("push", repoName); err == nil {
 		c.Fatalf("pushing the image to the private registry should have failed: output %q", out)
 	} else if !strings.Contains(out, expected) {
 		c.Fatalf("pushing the image failed with an unexpected message: expected %q, got %q", expected, out)
@@ -103,7 +103,7 @@ func (s *DockerRegistrySuite) TestPushInterrupt(c *check.C) {
 	if err := pushCmd.Process.Kill(); err != nil {
 		c.Fatalf("Failed to kill push process: %v", err)
 	}
-	if out, _, err := dockerCmdWithError(c, "push", repoName); err == nil {
+	if out, _, err := dockerCmdWithError("push", repoName); err == nil {
 		if !strings.Contains(out, "already in progress") {
 			c.Fatalf("Push should be continued on daemon side, but seems ok: %v, %s", err, out)
 		}
@@ -139,7 +139,7 @@ func (s *DockerRegistrySuite) TestPushEmptyLayer(c *check.C) {
 	}
 
 	// Now verify we can push it
-	if out, _, err := dockerCmdWithError(c, "push", repoName); err != nil {
+	if out, _, err := dockerCmdWithError("push", repoName); err != nil {
 		c.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err)
 	}
 }

+ 2 - 2
integration-cli/docker_cli_rename_test.go

@@ -66,11 +66,11 @@ func (s *DockerSuite) TestRenameCheckNames(c *check.C) {
 func (s *DockerSuite) TestRenameInvalidName(c *check.C) {
 	dockerCmd(c, "run", "--name", "myname", "-d", "busybox", "top")
 
-	if out, _, err := dockerCmdWithError(c, "rename", "myname", "new:invalid"); err == nil || !strings.Contains(out, "Invalid container name") {
+	if out, _, err := dockerCmdWithError("rename", "myname", "new:invalid"); err == nil || !strings.Contains(out, "Invalid container name") {
 		c.Fatalf("Renaming container to invalid name should have failed: %s\n%v", out, err)
 	}
 
-	if out, _, err := dockerCmdWithError(c, "ps", "-a"); err != nil || !strings.Contains(out, "myname") {
+	if out, _, err := dockerCmdWithError("ps", "-a"); err != nil || !strings.Contains(out, "myname") {
 		c.Fatalf("Output of docker ps should have included 'myname': %s\n%v", out, err)
 	}
 }

+ 5 - 5
integration-cli/docker_cli_rm_test.go

@@ -28,7 +28,7 @@ func (s *DockerSuite) TestRmContainerWithVolume(c *check.C) {
 func (s *DockerSuite) TestRmRunningContainer(c *check.C) {
 	createRunningContainer(c, "foo")
 
-	if _, _, err := dockerCmdWithError(c, "rm", "foo"); err == nil {
+	if _, _, err := dockerCmdWithError("rm", "foo"); err == nil {
 		c.Fatalf("Expected error, can't rm a running container")
 	}
 }
@@ -55,7 +55,7 @@ func (s *DockerSuite) TestRmContainerOrphaning(c *check.C) {
 		c.Fatalf("Could not build image %s: %v", img, err)
 	}
 	// run container on first image
-	if out, _, err := dockerCmdWithError(c, "run", img); err != nil {
+	if out, _, err := dockerCmdWithError("run", img); err != nil {
 		c.Fatalf("Could not run image %s: %v: %s", img, err, out)
 	}
 
@@ -64,12 +64,12 @@ func (s *DockerSuite) TestRmContainerOrphaning(c *check.C) {
 		c.Fatalf("Could not rebuild image %s: %v", img, err)
 	}
 	// try to remove the image, should error out.
-	if out, _, err := dockerCmdWithError(c, "rmi", img); err == nil {
+	if out, _, err := dockerCmdWithError("rmi", img); err == nil {
 		c.Fatalf("Expected to error out removing the image, but succeeded: %s", out)
 	}
 
 	// check if we deleted the first image
-	out, _, err := dockerCmdWithError(c, "images", "-q", "--no-trunc")
+	out, _, err := dockerCmdWithError("images", "-q", "--no-trunc")
 	if err != nil {
 		c.Fatalf("%v: %s", err, out)
 	}
@@ -79,7 +79,7 @@ func (s *DockerSuite) TestRmContainerOrphaning(c *check.C) {
 }
 
 func (s *DockerSuite) TestRmInvalidContainer(c *check.C) {
-	if out, _, err := dockerCmdWithError(c, "rm", "unknown"); err == nil {
+	if out, _, err := dockerCmdWithError("rm", "unknown"); err == nil {
 		c.Fatal("Expected error on rm unknown container, got none")
 	} else if !strings.Contains(out, "failed to remove containers") {
 		c.Fatalf("Expected output to contain 'failed to remove containers', got %q", out)

+ 22 - 22
integration-cli/docker_cli_rmi_test.go

@@ -12,7 +12,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
 	errSubstr := "is using it"
 
 	// create a container
-	out, _, err := dockerCmdWithError(c, "run", "-d", "busybox", "true")
+	out, _, err := dockerCmdWithError("run", "-d", "busybox", "true")
 	if err != nil {
 		c.Fatalf("failed to create a container: %s, %v", out, err)
 	}
@@ -20,7 +20,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
 	cleanedContainerID := strings.TrimSpace(out)
 
 	// try to delete the image
-	out, _, err = dockerCmdWithError(c, "rmi", "busybox")
+	out, _, err = dockerCmdWithError("rmi", "busybox")
 	if err == nil {
 		c.Fatalf("Container %q is using image, should not be able to rmi: %q", cleanedContainerID, out)
 	}
@@ -73,13 +73,13 @@ func (s *DockerSuite) TestRmiTag(c *check.C) {
 }
 
 func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-one'")
+	out, _, err := dockerCmdWithError("run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-one'")
 	if err != nil {
 		c.Fatalf("failed to create a container:%s, %v", out, err)
 	}
 
 	containerID := strings.TrimSpace(out)
-	out, _, err = dockerCmdWithError(c, "commit", containerID, "busybox-one")
+	out, _, err = dockerCmdWithError("commit", containerID, "busybox-one")
 	if err != nil {
 		c.Fatalf("failed to commit a new busybox-one:%s, %v", out, err)
 	}
@@ -97,7 +97,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
 	c.Assert(err, check.IsNil)
 
 	// run a container with the image
-	out, _, err = dockerCmdWithError(c, "run", "-d", "busybox-one", "top")
+	out, _, err = dockerCmdWithError("run", "-d", "busybox-one", "top")
 	if err != nil {
 		c.Fatalf("failed to create a container:%s, %v", out, err)
 	}
@@ -105,7 +105,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
 	containerID = strings.TrimSpace(out)
 
 	// first checkout without force it fails
-	out, _, err = dockerCmdWithError(c, "rmi", imgID)
+	out, _, err = dockerCmdWithError("rmi", imgID)
 	expected := fmt.Sprintf("Conflict, cannot delete %s because the running container %s is using it, stop it and use -f to force", imgID[:12], containerID[:12])
 	if err == nil || !strings.Contains(out, expected) {
 		c.Fatalf("rmi tagged in multiple repos should have failed without force: %s, %v, expected: %s", out, err, expected)
@@ -121,13 +121,13 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
 }
 
 func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-test'")
+	out, _, err := dockerCmdWithError("run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-test'")
 	if err != nil {
 		c.Fatalf("failed to create a container:%s, %v", out, err)
 	}
 
 	containerID := strings.TrimSpace(out)
-	out, _, err = dockerCmdWithError(c, "commit", containerID, "busybox-test")
+	out, _, err = dockerCmdWithError("commit", containerID, "busybox-test")
 	if err != nil {
 		c.Fatalf("failed to commit a new busybox-test:%s, %v", out, err)
 	}
@@ -147,7 +147,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
 	c.Assert(err, check.IsNil)
 
 	// first checkout without force it fails
-	out, _, err = dockerCmdWithError(c, "rmi", imgID)
+	out, _, err = dockerCmdWithError("rmi", imgID)
 	if err == nil || !strings.Contains(out, fmt.Sprintf("Conflict, cannot delete image %s because it is tagged in multiple repositories, use -f to force", imgID)) {
 		c.Fatalf("rmi tagged in multiple repos should have failed without force:%s, %v", out, err)
 	}
@@ -171,7 +171,7 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c
 	dockerCmd(c, "tag", imgID, newTag)
 	dockerCmd(c, "run", "-d", imgID, "top")
 
-	out, _, err := dockerCmdWithError(c, "rmi", "-f", imgID)
+	out, _, err := dockerCmdWithError("rmi", "-f", imgID)
 	if err == nil || !strings.Contains(out, "stop it and retry") {
 		c.Log(out)
 		c.Fatalf("rmi -f should not delete image with running containers")
@@ -182,13 +182,13 @@ func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) {
 	container := "test-delete-tag"
 	newtag := "busybox:newtag"
 	bb := "busybox:latest"
-	if out, _, err := dockerCmdWithError(c, "tag", bb, newtag); err != nil {
+	if out, _, err := dockerCmdWithError("tag", bb, newtag); err != nil {
 		c.Fatalf("Could not tag busybox: %v: %s", err, out)
 	}
-	if out, _, err := dockerCmdWithError(c, "run", "--name", container, bb, "/bin/true"); err != nil {
+	if out, _, err := dockerCmdWithError("run", "--name", container, bb, "/bin/true"); err != nil {
 		c.Fatalf("Could not run busybox: %v: %s", err, out)
 	}
-	out, _, err := dockerCmdWithError(c, "rmi", newtag)
+	out, _, err := dockerCmdWithError("rmi", newtag)
 	if err != nil {
 		c.Fatalf("Could not remove tag %s: %v: %s", newtag, err, out)
 	}
@@ -208,11 +208,11 @@ MAINTAINER foo`)
 		c.Fatalf("Could not build %s: %s, %v", image, out, err)
 	}
 
-	if out, _, err := dockerCmdWithError(c, "run", "--name", "test-force-rmi", image, "/bin/true"); err != nil {
+	if out, _, err := dockerCmdWithError("run", "--name", "test-force-rmi", image, "/bin/true"); err != nil {
 		c.Fatalf("Could not run container: %s, %v", out, err)
 	}
 
-	if out, _, err := dockerCmdWithError(c, "rmi", "-f", image); err != nil {
+	if out, _, err := dockerCmdWithError("rmi", "-f", image); err != nil {
 		c.Fatalf("Could not remove image %s:  %s, %v", image, out, err)
 	}
 }
@@ -221,22 +221,22 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
 	newRepo := "127.0.0.1:5000/busybox"
 	oldRepo := "busybox"
 	newTag := "busybox:test"
-	out, _, err := dockerCmdWithError(c, "tag", oldRepo, newRepo)
+	out, _, err := dockerCmdWithError("tag", oldRepo, newRepo)
 	if err != nil {
 		c.Fatalf("Could not tag busybox: %v: %s", err, out)
 	}
 
-	out, _, err = dockerCmdWithError(c, "run", "--name", "test", oldRepo, "touch", "/home/abcd")
+	out, _, err = dockerCmdWithError("run", "--name", "test", oldRepo, "touch", "/home/abcd")
 	if err != nil {
 		c.Fatalf("failed to run container: %v, output: %s", err, out)
 	}
 
-	out, _, err = dockerCmdWithError(c, "commit", "test", newTag)
+	out, _, err = dockerCmdWithError("commit", "test", newTag)
 	if err != nil {
 		c.Fatalf("failed to commit container: %v, output: %s", err, out)
 	}
 
-	out, _, err = dockerCmdWithError(c, "rmi", newTag)
+	out, _, err = dockerCmdWithError("rmi", newTag)
 	if err != nil {
 		c.Fatalf("failed to remove image: %v, output: %s", err, out)
 	}
@@ -247,7 +247,7 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
 
 func (s *DockerSuite) TestRmiBlank(c *check.C) {
 	// try to delete a blank image name
-	out, _, err := dockerCmdWithError(c, "rmi", "")
+	out, _, err := dockerCmdWithError("rmi", "")
 	if err == nil {
 		c.Fatal("Should have failed to delete '' image")
 	}
@@ -258,7 +258,7 @@ func (s *DockerSuite) TestRmiBlank(c *check.C) {
 		c.Fatalf("Expected error message not generated: %s", out)
 	}
 
-	out, _, err = dockerCmdWithError(c, "rmi", " ")
+	out, _, err = dockerCmdWithError("rmi", " ")
 	if err == nil {
 		c.Fatal("Should have failed to delete '' image")
 	}
@@ -286,7 +286,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
 	dockerCmd(c, "rmi", "-f", imageIds[1])
 
 	// Try to remove the image of the running container and see if it fails as expected.
-	out, _, err := dockerCmdWithError(c, "rmi", "-f", imageIds[0])
+	out, _, err := dockerCmdWithError("rmi", "-f", imageIds[0])
 	if err == nil || !strings.Contains(out, "is using it") {
 		c.Log(out)
 		c.Fatal("The image of the running container should not be removed.")

+ 63 - 63
integration-cli/docker_cli_run_test.go

@@ -52,7 +52,7 @@ func (s *DockerSuite) TestRunWithSwappiness(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--memory-swappiness", "101", "busybox", "true")
+	out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true")
 	if err == nil {
 		c.Fatalf("failed. test was able to set invalid value, output: %q", out)
 	}
@@ -108,7 +108,7 @@ func (s *DockerSuite) TestRunExitCodeZero(c *check.C) {
 // the exit code should be 1
 // some versions of lxc might make this test fail
 func (s *DockerSuite) TestRunExitCodeOne(c *check.C) {
-	_, exitCode, err := dockerCmdWithError(c, "run", "busybox", "false")
+	_, exitCode, err := dockerCmdWithError("run", "busybox", "false")
 	if err != nil && !strings.Contains("exit status 1", fmt.Sprintf("%s", err)) {
 		c.Fatal(err)
 	}
@@ -173,7 +173,7 @@ func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) {
 
 // pinging Google's DNS resolver should fail when we disable the networking
 func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
-	out, exitCode, err := dockerCmdWithError(c, "run", "--net=none", "busybox", "ping", "-c", "1", "8.8.8.8")
+	out, exitCode, err := dockerCmdWithError("run", "--net=none", "busybox", "ping", "-c", "1", "8.8.8.8")
 	if err != nil && exitCode != 1 {
 		c.Fatal(out, err)
 	}
@@ -181,7 +181,7 @@ func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
 		c.Errorf("--net=none should've disabled the network; the container shouldn't have been able to ping 8.8.8.8")
 	}
 
-	out, exitCode, err = dockerCmdWithError(c, "run", "-n=false", "busybox", "ping", "-c", "1", "8.8.8.8")
+	out, exitCode, err = dockerCmdWithError("run", "-n=false", "busybox", "ping", "-c", "1", "8.8.8.8")
 	if err != nil && exitCode != 1 {
 		c.Fatal(out, err)
 	}
@@ -219,7 +219,7 @@ func (s *DockerSuite) TestRunLinksContainerWithContainerId(c *check.C) {
 
 // Issue 9677.
 func (s *DockerSuite) TestRunWithDaemonFlags(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "--selinux-enabled", "run", "-i", "-t", "busybox", "true")
+	out, _, err := dockerCmdWithError("--selinux-enabled", "run", "-i", "-t", "busybox", "true")
 	if err != nil {
 		if !strings.Contains(out, "must follow the 'docker daemon' command") && // daemon
 			!strings.Contains(out, "flag provided but not defined: --selinux-enabled") { // no daemon (client-only)
@@ -269,7 +269,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunVolumesMountedAsReadonly(c *check.C) {
-	if _, code, err := dockerCmdWithError(c, "run", "-v", "/test:/test:ro", "busybox", "touch", "/test/somefile"); err == nil || code == 0 {
+	if _, code, err := dockerCmdWithError("run", "-v", "/test:/test:ro", "busybox", "touch", "/test/somefile"); err == nil || code == 0 {
 		c.Fatalf("run should fail because volume is ro: exit code %d", code)
 	}
 }
@@ -277,7 +277,7 @@ func (s *DockerSuite) TestRunVolumesMountedAsReadonly(c *check.C) {
 func (s *DockerSuite) TestRunVolumesFromInReadonlyMode(c *check.C) {
 	dockerCmd(c, "run", "--name", "parent", "-v", "/test", "busybox", "true")
 
-	if _, code, err := dockerCmdWithError(c, "run", "--volumes-from", "parent:ro", "busybox", "touch", "/test/file"); err == nil || code == 0 {
+	if _, code, err := dockerCmdWithError("run", "--volumes-from", "parent:ro", "busybox", "touch", "/test/file"); err == nil || code == 0 {
 		c.Fatalf("run should fail because volume is ro: exit code %d", code)
 	}
 }
@@ -287,7 +287,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
 	dockerCmd(c, "run", "--name", "parent", "-v", "/test", "busybox", "true")
 	dockerCmd(c, "run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file")
 
-	if out, _, err := dockerCmdWithError(c, "run", "--volumes-from", "parent:bar", "busybox", "touch", "/test/file"); err == nil || !strings.Contains(out, "invalid mode for volumes-from: bar") {
+	if out, _, err := dockerCmdWithError("run", "--volumes-from", "parent:bar", "busybox", "touch", "/test/file"); err == nil || !strings.Contains(out, "invalid mode for volumes-from: bar") {
 		c.Fatalf("running --volumes-from foo:bar should have failed with invalid mount mode: %q", out)
 	}
 
@@ -298,14 +298,14 @@ func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
 	dockerCmd(c, "run", "--name", "parent", "-v", "/test:/test:ro", "busybox", "true")
 
 	// Expect this "rw" mode to be be ignored since the inherited volume is "ro"
-	if _, _, err := dockerCmdWithError(c, "run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file"); err == nil {
+	if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file"); err == nil {
 		c.Fatal("Expected volumes-from to inherit read-only volume even when passing in `rw`")
 	}
 
 	dockerCmd(c, "run", "--name", "parent2", "-v", "/test:/test:ro", "busybox", "true")
 
 	// Expect this to be read-only since both are "ro"
-	if _, _, err := dockerCmdWithError(c, "run", "--volumes-from", "parent2:ro", "busybox", "touch", "/test/file"); err == nil {
+	if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent2:ro", "busybox", "touch", "/test/file"); err == nil {
 		c.Fatal("Expected volumes-from to inherit read-only volume even when passing in `ro`")
 	}
 }
@@ -315,7 +315,7 @@ func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
 	mountstr1 := randomUnixTmpDirPath("test1") + ":/someplace"
 	mountstr2 := randomUnixTmpDirPath("test2") + ":/someplace"
 
-	if out, _, err := dockerCmdWithError(c, "run", "-v", mountstr1, "-v", mountstr2, "busybox", "true"); err == nil {
+	if out, _, err := dockerCmdWithError("run", "-v", mountstr1, "-v", mountstr2, "busybox", "true"); err == nil {
 		c.Fatal("Expected error about duplicate volume definitions")
 	} else {
 		if !strings.Contains(out, "Duplicate bind mount") {
@@ -338,7 +338,7 @@ func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) {
 
 // this tests verifies the ID format for the container
 func (s *DockerSuite) TestRunVerifyContainerID(c *check.C) {
-	out, exit, err := dockerCmdWithError(c, "run", "-d", "busybox", "true")
+	out, exit, err := dockerCmdWithError("run", "-d", "busybox", "true")
 	if err != nil {
 		c.Fatal(err)
 	}
@@ -374,7 +374,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
 		c.Fatalf("could not build '%s': %v", image, err)
 	}
 
-	_, exitCode, err := dockerCmdWithError(c, "run", "-v", "/bar/foo", "--name", "test-createvolumewithsymlink", image, "sh", "-c", "mount | grep -q /home/foo")
+	_, exitCode, err := dockerCmdWithError("run", "-v", "/bar/foo", "--name", "test-createvolumewithsymlink", image, "sh", "-c", "mount | grep -q /home/foo")
 	if err != nil || exitCode != 0 {
 		c.Fatalf("[run] err: %v, exitcode: %d", err, exitCode)
 	}
@@ -384,7 +384,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
 		c.Fatalf("[inspect] err: %v", err)
 	}
 
-	_, exitCode, err = dockerCmdWithError(c, "rm", "-v", "test-createvolumewithsymlink")
+	_, exitCode, err = dockerCmdWithError("rm", "-v", "test-createvolumewithsymlink")
 	if err != nil || exitCode != 0 {
 		c.Fatalf("[rm] err: %v, exitcode: %d", err, exitCode)
 	}
@@ -409,19 +409,19 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) {
 		c.Fatalf("could not build 'docker-test-volumesfromsymlinkpath': %v", err)
 	}
 
-	_, exitCode, err := dockerCmdWithError(c, "run", "--name", "test-volumesfromsymlinkpath", name)
+	_, exitCode, err := dockerCmdWithError("run", "--name", "test-volumesfromsymlinkpath", name)
 	if err != nil || exitCode != 0 {
 		c.Fatalf("[run] (volume) err: %v, exitcode: %d", err, exitCode)
 	}
 
-	_, exitCode, err = dockerCmdWithError(c, "run", "--volumes-from", "test-volumesfromsymlinkpath", "busybox", "sh", "-c", "ls /foo | grep -q bar")
+	_, exitCode, err = dockerCmdWithError("run", "--volumes-from", "test-volumesfromsymlinkpath", "busybox", "sh", "-c", "ls /foo | grep -q bar")
 	if err != nil || exitCode != 0 {
 		c.Fatalf("[run] err: %v, exitcode: %d", err, exitCode)
 	}
 }
 
 func (s *DockerSuite) TestRunExitCode(c *check.C) {
-	_, exit, err := dockerCmdWithError(c, "run", "busybox", "/bin/sh", "-c", "exit 72")
+	_, exit, err := dockerCmdWithError("run", "busybox", "/bin/sh", "-c", "exit 72")
 	if err == nil {
 		c.Fatal("should not have a non nil error")
 	}
@@ -452,7 +452,7 @@ func (s *DockerSuite) TestRunUserByID(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunUserByIDBig(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-u", "2147483648", "busybox", "id")
+	out, _, err := dockerCmdWithError("run", "-u", "2147483648", "busybox", "id")
 	if err == nil {
 		c.Fatal("No error, but must be.", out)
 	}
@@ -462,7 +462,7 @@ func (s *DockerSuite) TestRunUserByIDBig(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunUserByIDNegative(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-u", "-1", "busybox", "id")
+	out, _, err := dockerCmdWithError("run", "-u", "-1", "busybox", "id")
 	if err == nil {
 		c.Fatal("No error, but must be.", out)
 	}
@@ -472,7 +472,7 @@ func (s *DockerSuite) TestRunUserByIDNegative(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunUserByIDZero(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-u", "0", "busybox", "id")
+	out, _, err := dockerCmdWithError("run", "-u", "0", "busybox", "id")
 	if err != nil {
 		c.Fatal(err, out)
 	}
@@ -482,7 +482,7 @@ func (s *DockerSuite) TestRunUserByIDZero(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunUserNotFound(c *check.C) {
-	_, _, err := dockerCmdWithError(c, "run", "-u", "notme", "busybox", "id")
+	_, _, err := dockerCmdWithError("run", "-u", "notme", "busybox", "id")
 	if err == nil {
 		c.Fatal("unknown user should cause container to fail")
 	}
@@ -496,7 +496,7 @@ func (s *DockerSuite) TestRunTwoConcurrentContainers(c *check.C) {
 	for i := 0; i < 2; i++ {
 		go func() {
 			defer group.Done()
-			_, _, err := dockerCmdWithError(c, "run", "busybox", "sleep", "2")
+			_, _, err := dockerCmdWithError("run", "busybox", "sleep", "2")
 			errChan <- err
 		}()
 	}
@@ -632,7 +632,7 @@ func (s *DockerSuite) TestRunContainerNetwork(c *check.C) {
 func (s *DockerSuite) TestRunNetHostNotAllowedWithLinks(c *check.C) {
 	dockerCmd(c, "run", "--name", "linked", "busybox", "true")
 
-	_, _, err := dockerCmdWithError(c, "run", "--net=host", "--link", "linked:linked", "busybox", "true")
+	_, _, err := dockerCmdWithError("run", "--net=host", "--link", "linked:linked", "busybox", "true")
 	if err == nil {
 		c.Fatal("Expected error")
 	}
@@ -665,14 +665,14 @@ func (s *DockerSuite) TestRunUnprivilegedCanMknod(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunCapDropInvalid(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--cap-drop=CHPASS", "busybox", "ls")
+	out, _, err := dockerCmdWithError("run", "--cap-drop=CHPASS", "busybox", "ls")
 	if err == nil {
 		c.Fatal(err, out)
 	}
 }
 
 func (s *DockerSuite) TestRunCapDropCannotMknod(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--cap-drop=MKNOD", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
+	out, _, err := dockerCmdWithError("run", "--cap-drop=MKNOD", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
 
 	if err == nil {
 		c.Fatal(err, out)
@@ -683,7 +683,7 @@ func (s *DockerSuite) TestRunCapDropCannotMknod(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunCapDropCannotMknodLowerCase(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--cap-drop=mknod", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
+	out, _, err := dockerCmdWithError("run", "--cap-drop=mknod", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
 
 	if err == nil {
 		c.Fatal(err, out)
@@ -694,7 +694,7 @@ func (s *DockerSuite) TestRunCapDropCannotMknodLowerCase(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunCapDropALLCannotMknod(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--cap-drop=ALL", "--cap-add=SETGID", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
+	out, _, err := dockerCmdWithError("run", "--cap-drop=ALL", "--cap-add=SETGID", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
 	if err == nil {
 		c.Fatal(err, out)
 	}
@@ -712,7 +712,7 @@ func (s *DockerSuite) TestRunCapDropALLAddMknodCanMknod(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunCapAddInvalid(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--cap-add=CHPASS", "busybox", "ls")
+	out, _, err := dockerCmdWithError("run", "--cap-add=CHPASS", "busybox", "ls")
 	if err == nil {
 		c.Fatal(err, out)
 	}
@@ -735,7 +735,7 @@ func (s *DockerSuite) TestRunCapAddALLCanDownInterface(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunCapAddALLDropNetAdminCanDownInterface(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--cap-add=ALL", "--cap-drop=NET_ADMIN", "busybox", "sh", "-c", "ip link set eth0 down && echo ok")
+	out, _, err := dockerCmdWithError("run", "--cap-add=ALL", "--cap-drop=NET_ADMIN", "busybox", "sh", "-c", "ip link set eth0 down && echo ok")
 	if err == nil {
 		c.Fatal(err, out)
 	}
@@ -763,7 +763,7 @@ func (s *DockerSuite) TestRunPrivilegedCanMount(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunUnprivilegedCannotMount(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok")
+	out, _, err := dockerCmdWithError("run", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok")
 
 	if err == nil {
 		c.Fatal(err, out)
@@ -774,19 +774,19 @@ func (s *DockerSuite) TestRunUnprivilegedCannotMount(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunSysNotWritableInNonPrivilegedContainers(c *check.C) {
-	if _, code, err := dockerCmdWithError(c, "run", "busybox", "touch", "/sys/kernel/profiling"); err == nil || code == 0 {
+	if _, code, err := dockerCmdWithError("run", "busybox", "touch", "/sys/kernel/profiling"); err == nil || code == 0 {
 		c.Fatal("sys should not be writable in a non privileged container")
 	}
 }
 
 func (s *DockerSuite) TestRunSysWritableInPrivilegedContainers(c *check.C) {
-	if _, code, err := dockerCmdWithError(c, "run", "--privileged", "busybox", "touch", "/sys/kernel/profiling"); err != nil || code != 0 {
+	if _, code, err := dockerCmdWithError("run", "--privileged", "busybox", "touch", "/sys/kernel/profiling"); err != nil || code != 0 {
 		c.Fatalf("sys should be writable in privileged container")
 	}
 }
 
 func (s *DockerSuite) TestRunProcNotWritableInNonPrivilegedContainers(c *check.C) {
-	if _, code, err := dockerCmdWithError(c, "run", "busybox", "touch", "/proc/sysrq-trigger"); err == nil || code == 0 {
+	if _, code, err := dockerCmdWithError("run", "busybox", "touch", "/proc/sysrq-trigger"); err == nil || code == 0 {
 		c.Fatal("proc should not be writable in a non privileged container")
 	}
 }
@@ -822,7 +822,7 @@ func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunWithBlkioInvalidWeight(c *check.C) {
-	if _, _, err := dockerCmdWithError(c, "run", "--blkio-weight", "5", "busybox", "true"); err == nil {
+	if _, _, err := dockerCmdWithError("run", "--blkio-weight", "5", "busybox", "true"); err == nil {
 		c.Fatalf("run with invalid blkio-weight should failed")
 	}
 }
@@ -890,7 +890,7 @@ func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-v", "/:/", "busybox", "ls", "/host")
+	out, _, err := dockerCmdWithError("run", "-v", "/:/", "busybox", "ls", "/host")
 	if err == nil {
 		c.Fatal(out, err)
 	}
@@ -1382,7 +1382,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
 
 // TestRunWorkdirExistsAndIsFile checks that if 'docker run -w' with existing file can be detected
 func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) {
-	out, exit, err := dockerCmdWithError(c, "run", "-w", "/bin/cat", "busybox")
+	out, exit, err := dockerCmdWithError("run", "-w", "/bin/cat", "busybox")
 	if !(err != nil && exit == 1 && strings.Contains(out, "Cannot mkdir: /bin/cat is not a directory")) {
 		c.Fatalf("Docker must complains about making dir, but we got out: %s, exit: %d, err: %s", out, exit, err)
 	}
@@ -1509,7 +1509,7 @@ func (s *DockerSuite) TestRunWriteResolvFileAndNotCommit(c *check.C) {
 
 func (s *DockerSuite) TestRunWithBadDevice(c *check.C) {
 	name := "baddevice"
-	out, _, err := dockerCmdWithError(c, "run", "--name", name, "--device", "/etc", "busybox", "true")
+	out, _, err := dockerCmdWithError("run", "--name", name, "--device", "/etc", "busybox", "true")
 
 	if err == nil {
 		c.Fatal("Run should fail with bad device")
@@ -1553,7 +1553,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) {
 	readFile(path.Join(tmpDir, "holla"), c) // Will fail if the file doesn't exist
 
 	// test mounting to an illegal destination directory
-	_, _, err = dockerCmdWithError(c, "run", "-v", fmt.Sprintf("%s:.", tmpDir), "busybox", "ls", ".")
+	_, _, err = dockerCmdWithError("run", "-v", fmt.Sprintf("%s:.", tmpDir), "busybox", "ls", ".")
 	if err == nil {
 		c.Fatal("Container bind mounted illegal directory")
 	}
@@ -1577,7 +1577,7 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *check.C) {
 	defer os.RemoveAll(tmpDir)
 	tmpCidFile := path.Join(tmpDir, "cid")
 
-	out, _, err := dockerCmdWithError(c, "run", "--cidfile", tmpCidFile, "emptyfs")
+	out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, "emptyfs")
 	if err == nil {
 		c.Fatalf("Run without command must fail. out=%s", out)
 	} else if !strings.Contains(out, "No command specified") {
@@ -1641,7 +1641,7 @@ func (s *DockerSuite) TestRunInspectMacAddress(c *check.C) {
 
 // test docker run use a invalid mac address
 func (s *DockerSuite) TestRunWithInvalidMacAddress(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--mac-address", "92:d0:c6:0a:29", "busybox")
+	out, _, err := dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29", "busybox")
 	//use a invalid mac address should with a error out
 	if err == nil || !strings.Contains(out, "is not a valid mac address") {
 		c.Fatalf("run with an invalid --mac-address should with error out")
@@ -1675,7 +1675,7 @@ func (s *DockerSuite) TestRunPortInUse(c *check.C) {
 	port := "1234"
 	dockerCmd(c, "run", "-d", "-p", port+":80", "busybox", "top")
 
-	out, _, err := dockerCmdWithError(c, "run", "-d", "-p", port+":80", "busybox", "top")
+	out, _, err := dockerCmdWithError("run", "-d", "-p", port+":80", "busybox", "top")
 	if err == nil {
 		c.Fatalf("Binding on used port must fail")
 	}
@@ -1800,12 +1800,12 @@ func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) {
 
 	dockerCmd(c, "run", "--name", "test", "-v", "/foo", "busybox")
 
-	if out, _, err := dockerCmdWithError(c, "run", "--volumes-from", "test", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
+	if out, _, err := dockerCmdWithError("run", "--volumes-from", "test", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
 		c.Fatalf("Data was copied on volumes-from but shouldn't be:\n%q", out)
 	}
 
 	tmpDir := randomUnixTmpDirPath("docker_test_bind_mount_copy_data")
-	if out, _, err := dockerCmdWithError(c, "run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
+	if out, _, err := dockerCmdWithError("run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
 		c.Fatalf("Data was copied on bind-mount but shouldn't be:\n%q", out)
 	}
 }
@@ -1902,7 +1902,7 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *check.C) {
 
 // test docker run expose a invalid port
 func (s *DockerSuite) TestRunExposePort(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--expose", "80000", "busybox")
+	out, _, err := dockerCmdWithError("run", "--expose", "80000", "busybox")
 	//expose a invalid port should with a error out
 	if err == nil || !strings.Contains(out, "Invalid range format for --expose") {
 		c.Fatalf("run --expose a invalid port should with error out")
@@ -1914,7 +1914,7 @@ func (s *DockerSuite) TestRunUnknownCommand(c *check.C) {
 	out, _, _ := dockerCmdWithStdoutStderr(c, "create", "busybox", "/bin/nada")
 
 	cID := strings.TrimSpace(out)
-	_, _, err := dockerCmdWithError(c, "start", cID)
+	_, _, err := dockerCmdWithError("start", cID)
 	c.Assert(err, check.NotNil)
 
 	rc, err := inspectField(cID, "State.ExitCode")
@@ -1972,7 +1972,7 @@ func (s *DockerSuite) TestRunModeIpcContainer(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunModeIpcContainerNotExists(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-d", "--ipc", "container:abcd1234", "busybox", "top")
+	out, _, err := dockerCmdWithError("run", "-d", "--ipc", "container:abcd1234", "busybox", "top")
 	if !strings.Contains(out, "abcd1234") || err == nil {
 		c.Fatalf("run IPC from a non exists container should with correct error out")
 	}
@@ -1984,7 +1984,7 @@ func (s *DockerSuite) TestRunModeIpcContainerNotRunning(c *check.C) {
 	out, _ := dockerCmd(c, "create", "busybox")
 
 	id := strings.TrimSpace(out)
-	out, _, err := dockerCmdWithError(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox")
+	out, _, err := dockerCmdWithError("run", fmt.Sprintf("--ipc=container:%s", id), "busybox")
 	if err == nil {
 		c.Fatalf("Run container with ipc mode container should fail with non running container: %s\n%s", out, err)
 	}
@@ -2056,18 +2056,18 @@ func (s *DockerSuite) TestRunModeUTSHost(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunTLSverify(c *check.C) {
-	if out, code, err := dockerCmdWithError(c, "ps"); err != nil || code != 0 {
+	if out, code, err := dockerCmdWithError("ps"); err != nil || code != 0 {
 		c.Fatalf("Should have worked: %v:\n%v", err, out)
 	}
 
 	// Regardless of whether we specify true or false we need to
 	// test to make sure tls is turned on if --tlsverify is specified at all
-	out, code, err := dockerCmdWithError(c, "--tlsverify=false", "ps")
+	out, code, err := dockerCmdWithError("--tlsverify=false", "ps")
 	if err == nil || code == 0 || !strings.Contains(out, "trying to connect") {
 		c.Fatalf("Should have failed: \net:%v\nout:%v\nerr:%v", code, out, err)
 	}
 
-	out, code, err = dockerCmdWithError(c, "--tlsverify=true", "ps")
+	out, code, err = dockerCmdWithError("--tlsverify=true", "ps")
 	if err == nil || code == 0 || !strings.Contains(out, "cert") {
 		c.Fatalf("Should have failed: \net:%v\nout:%v\nerr:%v", code, out, err)
 	}
@@ -2264,7 +2264,7 @@ func (s *DockerSuite) TestPermissionsPtsReadonlyRootfs(c *check.C) {
 func testReadOnlyFile(filename string, c *check.C) {
 	testRequires(c, NativeExecDriver)
 
-	out, _, err := dockerCmdWithError(c, "run", "--read-only", "--rm", "busybox", "touch", filename)
+	out, _, err := dockerCmdWithError("run", "--read-only", "--rm", "busybox", "touch", filename)
 	if err == nil {
 		c.Fatal("expected container to error on run with read only error")
 	}
@@ -2273,7 +2273,7 @@ func testReadOnlyFile(filename string, c *check.C) {
 		c.Fatalf("expected output from failure to contain %s but contains %s", expected, out)
 	}
 
-	out, _, err = dockerCmdWithError(c, "run", "--read-only", "--privileged", "--rm", "busybox", "touch", filename)
+	out, _, err = dockerCmdWithError("run", "--read-only", "--privileged", "--rm", "busybox", "touch", filename)
 	if err == nil {
 		c.Fatal("expected container to error on run with read only error")
 	}
@@ -2326,7 +2326,7 @@ func (s *DockerSuite) TestRunVolumesFromRestartAfterRemoved(c *check.C) {
 // run container with --rm should remove container if exit code != 0
 func (s *DockerSuite) TestRunContainerWithRmFlagExitCodeNotEqualToZero(c *check.C) {
 	name := "flowers"
-	out, _, err := dockerCmdWithError(c, "run", "--name", name, "--rm", "busybox", "ls", "/notexists")
+	out, _, err := dockerCmdWithError("run", "--name", name, "--rm", "busybox", "ls", "/notexists")
 	if err == nil {
 		c.Fatal("Expected docker run to fail", out, err)
 	}
@@ -2343,7 +2343,7 @@ func (s *DockerSuite) TestRunContainerWithRmFlagExitCodeNotEqualToZero(c *check.
 
 func (s *DockerSuite) TestRunContainerWithRmFlagCannotStartContainer(c *check.C) {
 	name := "sparkles"
-	out, _, err := dockerCmdWithError(c, "run", "--name", name, "--rm", "busybox", "commandNotFound")
+	out, _, err := dockerCmdWithError("run", "--name", name, "--rm", "busybox", "commandNotFound")
 	if err == nil {
 		c.Fatal("Expected docker run to fail", out, err)
 	}
@@ -2365,7 +2365,7 @@ func (s *DockerSuite) TestRunPidHostWithChildIsKillable(c *check.C) {
 	time.Sleep(1 * time.Second)
 	errchan := make(chan error)
 	go func() {
-		if out, _, err := dockerCmdWithError(c, "kill", name); err != nil {
+		if out, _, err := dockerCmdWithError("kill", name); err != nil {
 			errchan <- fmt.Errorf("%v:\n%s", err, out)
 		}
 		close(errchan)
@@ -2381,14 +2381,14 @@ func (s *DockerSuite) TestRunPidHostWithChildIsKillable(c *check.C) {
 func (s *DockerSuite) TestRunWithTooSmallMemoryLimit(c *check.C) {
 	// this memory limit is 1 byte less than the min, which is 4MB
 	// https://github.com/docker/docker/blob/v1.5.0/daemon/create.go#L22
-	out, _, err := dockerCmdWithError(c, "run", "-m", "4194303", "busybox")
+	out, _, err := dockerCmdWithError("run", "-m", "4194303", "busybox")
 	if err == nil || !strings.Contains(out, "Minimum memory limit allowed is 4MB") {
 		c.Fatalf("expected run to fail when using too low a memory limit: %q", out)
 	}
 }
 
 func (s *DockerSuite) TestRunWriteToProcAsound(c *check.C) {
-	_, code, err := dockerCmdWithError(c, "run", "busybox", "sh", "-c", "echo 111 >> /proc/asound/version")
+	_, code, err := dockerCmdWithError("run", "busybox", "sh", "-c", "echo 111 >> /proc/asound/version")
 	if err == nil || code == 0 {
 		c.Fatal("standard container should not be able to write to /proc/asound")
 	}
@@ -2396,7 +2396,7 @@ func (s *DockerSuite) TestRunWriteToProcAsound(c *check.C) {
 
 func (s *DockerSuite) TestRunReadProcTimer(c *check.C) {
 	testRequires(c, NativeExecDriver)
-	out, code, err := dockerCmdWithError(c, "run", "busybox", "cat", "/proc/timer_stats")
+	out, code, err := dockerCmdWithError("run", "busybox", "cat", "/proc/timer_stats")
 	if err != nil || code != 0 {
 		c.Fatal(err)
 	}
@@ -2413,7 +2413,7 @@ func (s *DockerSuite) TestRunReadProcLatency(c *check.C) {
 		c.Skip("kernel doesnt have latency_stats configured")
 		return
 	}
-	out, code, err := dockerCmdWithError(c, "run", "busybox", "cat", "/proc/latency_stats")
+	out, code, err := dockerCmdWithError("run", "busybox", "cat", "/proc/latency_stats")
 	if err != nil || code != 0 {
 		c.Fatal(err)
 	}
@@ -2424,7 +2424,7 @@ func (s *DockerSuite) TestRunReadProcLatency(c *check.C) {
 
 func (s *DockerSuite) TestMountIntoProc(c *check.C) {
 	testRequires(c, NativeExecDriver)
-	_, code, err := dockerCmdWithError(c, "run", "-v", "/proc//sys", "busybox", "true")
+	_, code, err := dockerCmdWithError("run", "-v", "/proc//sys", "busybox", "true")
 	if err == nil || code == 0 {
 		c.Fatal("container should not be able to mount into /proc")
 	}
@@ -2439,18 +2439,18 @@ func (s *DockerSuite) TestRunUnshareProc(c *check.C) {
 	testRequires(c, Apparmor, NativeExecDriver)
 
 	name := "acidburn"
-	if out, _, err := dockerCmdWithError(c, "run", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "--mount-proc=/proc", "mount"); err == nil || !strings.Contains(out, "Permission denied") {
+	if out, _, err := dockerCmdWithError("run", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "--mount-proc=/proc", "mount"); err == nil || !strings.Contains(out, "Permission denied") {
 		c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
 	}
 
 	name = "cereal"
-	if out, _, err := dockerCmdWithError(c, "run", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "mount", "-t", "proc", "none", "/proc"); err == nil || !strings.Contains(out, "Permission denied") {
+	if out, _, err := dockerCmdWithError("run", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "mount", "-t", "proc", "none", "/proc"); err == nil || !strings.Contains(out, "Permission denied") {
 		c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
 	}
 
 	/* Ensure still fails if running privileged with the default policy */
 	name = "crashoverride"
-	if out, _, err := dockerCmdWithError(c, "run", "--privileged", "--security-opt", "apparmor:docker-default", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "mount", "-t", "proc", "none", "/proc"); err == nil || !strings.Contains(out, "Permission denied") {
+	if out, _, err := dockerCmdWithError("run", "--privileged", "--security-opt", "apparmor:docker-default", "--name", name, "jess/unshare", "unshare", "-p", "-m", "-f", "-r", "mount", "-t", "proc", "none", "/proc"); err == nil || !strings.Contains(out, "Permission denied") {
 		c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
 	}
 }

+ 15 - 15
integration-cli/docker_cli_run_unix_test.go

@@ -102,7 +102,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupParent(c *check.C) {
 	cgroupParent := "test"
 	name := "cgroup-test"
 
-	out, _, err := dockerCmdWithError(c, "run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
+	out, _, err := dockerCmdWithError("run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
 	if err != nil {
 		c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err)
 	}
@@ -130,7 +130,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupParentAbsPath(c *check.C) {
 
 	cgroupParent := "/cgroup-parent/test"
 	name := "cgroup-test"
-	out, _, err := dockerCmdWithError(c, "run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
+	out, _, err := dockerCmdWithError("run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
 	if err != nil {
 		c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err)
 	}
@@ -157,7 +157,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupMountRO(c *check.C) {
 	testRequires(c, NativeExecDriver)
 
 	filename := "/sys/fs/cgroup/devices/test123"
-	out, _, err := dockerCmdWithError(c, "run", "busybox", "touch", filename)
+	out, _, err := dockerCmdWithError("run", "busybox", "touch", filename)
 	if err == nil {
 		c.Fatal("expected cgroup mount point to be read-only, touch file should fail")
 	}
@@ -252,7 +252,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *check.C) {
 func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) {
 	testRequires(c, cpuCfsQuota)
 
-	out, _, err := dockerCmdWithError(c, "run", "--cpu-quota", "8000", "--name", "test", "busybox", "echo", "test")
+	out, _, err := dockerCmdWithError("run", "--cpu-quota", "8000", "--name", "test", "busybox", "echo", "test")
 	if err != nil {
 		c.Fatalf("failed to run container: %v, output: %q", err, out)
 	}
@@ -272,7 +272,7 @@ func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) {
 func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
 	testRequires(c, cpuCfsPeriod)
 
-	if _, _, err := dockerCmdWithError(c, "run", "--cpu-period", "50000", "--name", "test", "busybox", "true"); err != nil {
+	if _, _, err := dockerCmdWithError("run", "--cpu-period", "50000", "--name", "test", "busybox", "true"); err != nil {
 		c.Fatalf("failed to run container: %v", err)
 	}
 
@@ -288,7 +288,7 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
 	errChan := make(chan error)
 	go func() {
 		defer close(errChan)
-		out, exitCode, _ := dockerCmdWithError(c, "run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
+		out, exitCode, _ := dockerCmdWithError("run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
 		if expected := 137; exitCode != expected {
 			errChan <- fmt.Errorf("wrong exit code for OOM container: expected %d, got %d (output: %q)", expected, exitCode, out)
 		}
@@ -303,29 +303,29 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
 }
 
 func (s *DockerSuite) TestContainerNetworkModeToSelf(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "--name=me", "--net=container:me", "busybox", "true")
+	out, _, err := dockerCmdWithError("run", "--name=me", "--net=container:me", "busybox", "true")
 	if err == nil || !strings.Contains(out, "cannot join own network") {
 		c.Fatalf("using container net mode to self should result in an error")
 	}
 }
 
 func (s *DockerSuite) TestRunContainerNetModeWithDnsMacHosts(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-d", "--name", "parent", "busybox", "top")
+	out, _, err := dockerCmdWithError("run", "-d", "--name", "parent", "busybox", "top")
 	if err != nil {
 		c.Fatalf("failed to run container: %v, output: %q", err, out)
 	}
 
-	out, _, err = dockerCmdWithError(c, "run", "--dns", "1.2.3.4", "--net=container:parent", "busybox")
+	out, _, err = dockerCmdWithError("run", "--dns", "1.2.3.4", "--net=container:parent", "busybox")
 	if err == nil || !strings.Contains(out, "Conflicting options: --dns and the network mode") {
 		c.Fatalf("run --net=container with --dns should error out")
 	}
 
-	out, _, err = dockerCmdWithError(c, "run", "--mac-address", "92:d0:c6:0a:29:33", "--net=container:parent", "busybox")
+	out, _, err = dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29:33", "--net=container:parent", "busybox")
 	if err == nil || !strings.Contains(out, "--mac-address and the network mode") {
 		c.Fatalf("run --net=container with --mac-address should error out")
 	}
 
-	out, _, err = dockerCmdWithError(c, "run", "--add-host", "test:192.168.2.109", "--net=container:parent", "busybox")
+	out, _, err = dockerCmdWithError("run", "--add-host", "test:192.168.2.109", "--net=container:parent", "busybox")
 	if err == nil || !strings.Contains(out, "--add-host and the network mode") {
 		c.Fatalf("run --net=container with --add-host should error out")
 	}
@@ -334,17 +334,17 @@ func (s *DockerSuite) TestRunContainerNetModeWithDnsMacHosts(c *check.C) {
 func (s *DockerSuite) TestRunContainerNetModeWithExposePort(c *check.C) {
 	dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
 
-	out, _, err := dockerCmdWithError(c, "run", "-p", "5000:5000", "--net=container:parent", "busybox")
+	out, _, err := dockerCmdWithError("run", "-p", "5000:5000", "--net=container:parent", "busybox")
 	if err == nil || !strings.Contains(out, "Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)") {
 		c.Fatalf("run --net=container with -p should error out")
 	}
 
-	out, _, err = dockerCmdWithError(c, "run", "-P", "--net=container:parent", "busybox")
+	out, _, err = dockerCmdWithError("run", "-P", "--net=container:parent", "busybox")
 	if err == nil || !strings.Contains(out, "Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)") {
 		c.Fatalf("run --net=container with -P should error out")
 	}
 
-	out, _, err = dockerCmdWithError(c, "run", "--expose", "5000", "--net=container:parent", "busybox")
+	out, _, err = dockerCmdWithError("run", "--expose", "5000", "--net=container:parent", "busybox")
 	if err == nil || !strings.Contains(out, "Conflicting options: --expose and the network mode (--expose)") {
 		c.Fatalf("run --net=container with --expose should error out")
 	}
@@ -399,7 +399,7 @@ func (s *DockerSuite) TestRunModeNetContainerHostname(c *check.C) {
 }
 
 func (s *DockerSuite) TestRunNetworkNotInitializedNoneMode(c *check.C) {
-	out, _, err := dockerCmdWithError(c, "run", "-d", "--net=none", "busybox", "top")
+	out, _, err := dockerCmdWithError("run", "-d", "--net=none", "busybox", "top")
 	id := strings.TrimSpace(out)
 	res, err := inspectField(id, "NetworkSettings.IPAddress")
 	c.Assert(err, check.IsNil)

+ 2 - 2
integration-cli/docker_cli_save_load_test.go

@@ -39,7 +39,7 @@ func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) {
 		c.Fatalf("expected error, but succeeded with no error and output: %v", out)
 	}
 
-	after, _, err := dockerCmdWithError(c, "inspect", repoName)
+	after, _, err := dockerCmdWithError("inspect", repoName)
 	if err == nil {
 		c.Fatalf("the repo should not exist: %v", after)
 	}
@@ -72,7 +72,7 @@ func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) {
 		c.Fatalf("expected error, but succeeded with no error and output: %v", out)
 	}
 
-	after, _, err := dockerCmdWithError(c, "inspect", repoName)
+	after, _, err := dockerCmdWithError("inspect", repoName)
 	if err == nil {
 		c.Fatalf("the repo should not exist: %v", after)
 	}

+ 2 - 2
integration-cli/docker_cli_search_test.go

@@ -21,7 +21,7 @@ func (s *DockerSuite) TestSearchOnCentralRegistry(c *check.C) {
 }
 
 func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
-	out, exitCode, err := dockerCmdWithError(c, "search", "--stars=a", "busybox")
+	out, exitCode, err := dockerCmdWithError("search", "--stars=a", "busybox")
 	if err == nil || exitCode == 0 {
 		c.Fatalf("Should not get right information: %s, %v", out, err)
 	}
@@ -30,7 +30,7 @@ func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
 		c.Fatal("couldn't find the invalid value warning")
 	}
 
-	out, exitCode, err = dockerCmdWithError(c, "search", "-s=-1", "busybox")
+	out, exitCode, err = dockerCmdWithError("search", "-s=-1", "busybox")
 	if err == nil || exitCode == 0 {
 		c.Fatalf("Should not get right information: %s, %v", out, err)
 	}

+ 7 - 7
integration-cli/docker_cli_start_test.go

@@ -14,7 +14,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
 	dockerCmd(c, "wait", "test")
 
 	// Expect this to fail because the above container is stopped, this is what we want
-	if _, _, err := dockerCmdWithError(c, "run", "-d", "--name", "test2", "--link", "test:test", "busybox"); err == nil {
+	if _, _, err := dockerCmdWithError("run", "-d", "--name", "test2", "--link", "test:test", "busybox"); err == nil {
 		c.Fatal("Expected error but got none")
 	}
 
@@ -22,7 +22,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
 	go func() {
 		// Attempt to start attached to the container that won't start
 		// This should return an error immediately since the container can't be started
-		if _, _, err := dockerCmdWithError(c, "start", "-a", "test2"); err == nil {
+		if _, _, err := dockerCmdWithError("start", "-a", "test2"); err == nil {
 			ch <- fmt.Errorf("Expected error but got none")
 		}
 		close(ch)
@@ -44,7 +44,7 @@ func (s *DockerSuite) TestStartAttachCorrectExitCode(c *check.C) {
 	// make sure the container has exited before trying the "start -a"
 	dockerCmd(c, "wait", out)
 
-	startOut, exitCode, err := dockerCmdWithError(c, "start", "-a", out)
+	startOut, exitCode, err := dockerCmdWithError("start", "-a", out)
 	if err != nil && !strings.Contains("exit status 1", fmt.Sprintf("%s", err)) {
 		c.Fatalf("start command failed unexpectedly with error: %v, output: %q", err, startOut)
 	}
@@ -78,7 +78,7 @@ func (s *DockerSuite) TestStartRecordError(c *check.C) {
 	}
 
 	// Expect this to fail and records error because of ports conflict
-	out, _, err := dockerCmdWithError(c, "run", "-d", "--name", "test2", "-p", "9999:9999", "busybox", "top")
+	out, _, err := dockerCmdWithError("run", "-d", "--name", "test2", "-p", "9999:9999", "busybox", "top")
 	if err == nil {
 		c.Fatalf("Expected error but got none, output %q", out)
 	}
@@ -107,7 +107,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *check.C) {
 
 	dockerCmd(c, "pause", "testing")
 
-	if out, _, err := dockerCmdWithError(c, "start", "testing"); err == nil || !strings.Contains(out, "Cannot start a paused container, try unpause instead.") {
+	if out, _, err := dockerCmdWithError("start", "testing"); err == nil || !strings.Contains(out, "Cannot start a paused container, try unpause instead.") {
 		c.Fatalf("an error should have been shown that you cannot start paused container: %s\n%v", out, err)
 	}
 }
@@ -131,7 +131,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
 
 	// start all the three containers, container `child_first` start first which should be failed
 	// container 'parent' start second and then start container 'child_second'
-	out, _, err = dockerCmdWithError(c, "start", "child_first", "parent", "child_second")
+	out, _, err = dockerCmdWithError("start", "child_first", "parent", "child_second")
 	if !strings.Contains(out, "Cannot start container child_first") || err == nil {
 		c.Fatal("Expected error but got none")
 	}
@@ -159,7 +159,7 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *check.C) {
 
 	// test start and attach multiple containers at once, expected error
 	for _, option := range []string{"-a", "-i", "-ai"} {
-		out, _, err := dockerCmdWithError(c, "start", option, "test1", "test2", "test3")
+		out, _, err := dockerCmdWithError("start", option, "test1", "test2", "test3")
 		if !strings.Contains(out, "You cannot start and attach multiple containers at once.") || err == nil {
 			c.Fatal("Expected error but got none")
 		}

+ 10 - 10
integration-cli/docker_cli_tag_test.go

@@ -29,7 +29,7 @@ func (s *DockerSuite) TestTagInvalidUnprefixedRepo(c *check.C) {
 	invalidRepos := []string{"fo$z$", "Foo@3cc", "Foo$3", "Foo*3", "Fo^3", "Foo!3", "F)xcz(", "fo%asd"}
 
 	for _, repo := range invalidRepos {
-		_, _, err := dockerCmdWithError(c, "tag", "busybox", repo)
+		_, _, err := dockerCmdWithError("tag", "busybox", repo)
 		if err == nil {
 			c.Fatalf("tag busybox %v should have failed", repo)
 		}
@@ -43,7 +43,7 @@ func (s *DockerSuite) TestTagInvalidPrefixedRepo(c *check.C) {
 	invalidTags := []string{"repo:fo$z$", "repo:Foo@3cc", "repo:Foo$3", "repo:Foo*3", "repo:Fo^3", "repo:Foo!3", "repo:%goodbye", "repo:#hashtagit", "repo:F)xcz(", "repo:-foo", "repo:..", longTag}
 
 	for _, repotag := range invalidTags {
-		_, _, err := dockerCmdWithError(c, "tag", "busybox", repotag)
+		_, _, err := dockerCmdWithError("tag", "busybox", repotag)
 		if err == nil {
 			c.Fatalf("tag busybox %v should have failed", repotag)
 		}
@@ -59,7 +59,7 @@ func (s *DockerSuite) TestTagValidPrefixedRepo(c *check.C) {
 	validRepos := []string{"fooo/bar", "fooaa/test", "foooo:t"}
 
 	for _, repo := range validRepos {
-		_, _, err := dockerCmdWithError(c, "tag", "busybox:latest", repo)
+		_, _, err := dockerCmdWithError("tag", "busybox:latest", repo)
 		if err != nil {
 			c.Errorf("tag busybox %v should have worked: %s", repo, err)
 			continue
@@ -75,7 +75,7 @@ func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
 	}
 
 	dockerCmd(c, "tag", "busybox:latest", "busybox:test")
-	out, _, err := dockerCmdWithError(c, "tag", "busybox:latest", "busybox:test")
+	out, _, err := dockerCmdWithError("tag", "busybox:latest", "busybox:test")
 	if err == nil || !strings.Contains(out, "Conflict: Tag test is already set to image") {
 		c.Fatal("tag busybox busybox:test should have failed,because busybox:test is existed")
 	}
@@ -96,17 +96,17 @@ func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) {
 		c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
 	}
 	// test repository name begin with '-'
-	out, _, err := dockerCmdWithError(c, "tag", "busybox:latest", "-busybox:test")
+	out, _, err := dockerCmdWithError("tag", "busybox:latest", "-busybox:test")
 	if err == nil || !strings.Contains(out, "repository name component must match") {
 		c.Fatal("tag a name begin with '-' should failed")
 	}
 	// test namespace name begin with '-'
-	out, _, err = dockerCmdWithError(c, "tag", "busybox:latest", "-test/busybox:test")
+	out, _, err = dockerCmdWithError("tag", "busybox:latest", "-test/busybox:test")
 	if err == nil || !strings.Contains(out, "repository name component must match") {
 		c.Fatal("tag a name begin with '-' should failed")
 	}
 	// test index name begin wiht '-'
-	out, _, err = dockerCmdWithError(c, "tag", "busybox:latest", "-index:5000/busybox:test")
+	out, _, err = dockerCmdWithError("tag", "busybox:latest", "-index:5000/busybox:test")
 	if err == nil || !strings.Contains(out, "Invalid index name (-index:5000). Cannot begin or end with a hyphen") {
 		c.Fatal("tag a name begin with '-' should failed")
 	}
@@ -124,14 +124,14 @@ func (s *DockerSuite) TestTagOfficialNames(c *check.C) {
 	}
 
 	for _, name := range names {
-		out, exitCode, err := dockerCmdWithError(c, "tag", "-f", "busybox:latest", name+":latest")
+		out, exitCode, err := dockerCmdWithError("tag", "-f", "busybox:latest", name+":latest")
 		if err != nil || exitCode != 0 {
 			c.Errorf("tag busybox %v should have worked: %s, %s", name, err, out)
 			continue
 		}
 
 		// ensure we don't have multiple tag names.
-		out, _, err = dockerCmdWithError(c, "images")
+		out, _, err = dockerCmdWithError("images")
 		if err != nil {
 			c.Errorf("listing images failed with errors: %v, %s", err, out)
 		} else if strings.Contains(out, name) {
@@ -141,7 +141,7 @@ func (s *DockerSuite) TestTagOfficialNames(c *check.C) {
 	}
 
 	for _, name := range names {
-		_, exitCode, err := dockerCmdWithError(c, "tag", "-f", name+":latest", "fooo/bar:latest")
+		_, exitCode, err := dockerCmdWithError("tag", "-f", name+":latest", "fooo/bar:latest")
 		if err != nil || exitCode != 0 {
 			c.Errorf("tag %v fooo/bar should have worked: %s", name, err)
 			continue

+ 1 - 1
integration-cli/docker_utils.go

@@ -581,7 +581,7 @@ func pullImageIfNotExist(image string) (err error) {
 	return
 }
 
-func dockerCmdWithError(c *check.C, args ...string) (string, int, error) {
+func dockerCmdWithError(args ...string) (string, int, error) {
 	return runCommandWithOutput(exec.Command(dockerBinary, args...))
 }