Signed-off-by: Brian Goff <cpuguy83@gmail.com>
| ... | ... |
@@ -329,7 +329,7 @@ func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
|
| 329 | 329 |
c.Assert(err, check.IsNil) |
| 330 | 330 |
|
| 331 | 331 |
// Now remove without `-f` and make sure we are still pulling stats |
| 332 |
- _, _, err = dockerCmdWithError(c, "rm", id) |
|
| 332 |
+ _, _, err = dockerCmdWithError("rm", id)
|
|
| 333 | 333 |
c.Assert(err, check.Not(check.IsNil), check.Commentf("rm should have failed but didn't"))
|
| 334 | 334 |
_, err = buf.ReadTimeout(b, 2*time.Second) |
| 335 | 335 |
c.Assert(err, check.IsNil) |
| ... | ... |
@@ -4129,7 +4129,7 @@ func (s *DockerSuite) TestBuildFromGITwithF(c *check.C) {
|
| 4129 | 4129 |
} |
| 4130 | 4130 |
defer git.Close() |
| 4131 | 4131 |
|
| 4132 |
- out, _, err := dockerCmdWithError(c, "build", "-t", name, "--no-cache", "-f", "myApp/myDockerfile", git.RepoURL) |
|
| 4132 |
+ out, _, err := dockerCmdWithError("build", "-t", name, "--no-cache", "-f", "myApp/myDockerfile", git.RepoURL)
|
|
| 4133 | 4133 |
if err != nil {
|
| 4134 | 4134 |
c.Fatalf("Error on build. Out: %s\nErr: %v", out, err)
|
| 4135 | 4135 |
} |
| ... | ... |
@@ -4364,7 +4364,7 @@ func (s *DockerSuite) TestBuildEntrypointInheritance(c *check.C) {
|
| 4364 | 4364 |
c.Fatal(err) |
| 4365 | 4365 |
} |
| 4366 | 4366 |
|
| 4367 |
- if _, status, _ := dockerCmdWithError(c, "run", "parent"); status != 130 {
|
|
| 4367 |
+ if _, status, _ := dockerCmdWithError("run", "parent"); status != 130 {
|
|
| 4368 | 4368 |
c.Fatalf("expected exit code 130 but received %d", status)
|
| 4369 | 4369 |
} |
| 4370 | 4370 |
|
| ... | ... |
@@ -4375,7 +4375,7 @@ func (s *DockerSuite) TestBuildEntrypointInheritance(c *check.C) {
|
| 4375 | 4375 |
c.Fatal(err) |
| 4376 | 4376 |
} |
| 4377 | 4377 |
|
| 4378 |
- if _, status, _ := dockerCmdWithError(c, "run", "child"); status != 5 {
|
|
| 4378 |
+ if _, status, _ := dockerCmdWithError("run", "child"); status != 5 {
|
|
| 4379 | 4379 |
c.Fatalf("expected exit code 5 but received %d", status)
|
| 4380 | 4380 |
} |
| 4381 | 4381 |
|
| ... | ... |
@@ -4471,7 +4471,7 @@ func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) {
|
| 4471 | 4471 |
c.Fatal(err) |
| 4472 | 4472 |
} |
| 4473 | 4473 |
|
| 4474 |
- if _, _, err := dockerCmdWithError(c, "run", "--rm", name); err == nil {
|
|
| 4474 |
+ if _, _, err := dockerCmdWithError("run", "--rm", name); err == nil {
|
|
| 4475 | 4475 |
c.Fatal("The image was not supposed to be able to run")
|
| 4476 | 4476 |
} |
| 4477 | 4477 |
|
| ... | ... |
@@ -5017,7 +5017,7 @@ func (s *DockerSuite) TestBuildDockerfileOutsideContext(c *check.C) {
|
| 5017 | 5017 |
filepath.Join(ctx, "dockerfile1"), |
| 5018 | 5018 |
filepath.Join(ctx, "dockerfile2"), |
| 5019 | 5019 |
} {
|
| 5020 |
- out, _, err := dockerCmdWithError(c, "build", "-t", name, "--no-cache", "-f", dockerfilePath, ".") |
|
| 5020 |
+ out, _, err := dockerCmdWithError("build", "-t", name, "--no-cache", "-f", dockerfilePath, ".")
|
|
| 5021 | 5021 |
if err == nil {
|
| 5022 | 5022 |
c.Fatalf("Expected error with %s. Out: %s", dockerfilePath, out)
|
| 5023 | 5023 |
} |
| ... | ... |
@@ -5031,7 +5031,7 @@ func (s *DockerSuite) TestBuildDockerfileOutsideContext(c *check.C) {
|
| 5031 | 5031 |
|
| 5032 | 5032 |
// Path to Dockerfile should be resolved relative to working directory, not relative to context. |
| 5033 | 5033 |
// There is a Dockerfile in the context, but since there is no Dockerfile in the current directory, the following should fail |
| 5034 |
- out, _, err := dockerCmdWithError(c, "build", "-t", name, "--no-cache", "-f", "Dockerfile", ctx) |
|
| 5034 |
+ out, _, err := dockerCmdWithError("build", "-t", name, "--no-cache", "-f", "Dockerfile", ctx)
|
|
| 5035 | 5035 |
if err == nil {
|
| 5036 | 5036 |
c.Fatalf("Expected error. Out: %s", out)
|
| 5037 | 5037 |
} |
| ... | ... |
@@ -26,7 +26,7 @@ func setupImageWithTag(c *check.C, tag string) (string, error) {
|
| 26 | 26 |
|
| 27 | 27 |
// tag the image to upload it to the private registry |
| 28 | 28 |
repoAndTag := utils.ImageReference(repoName, tag) |
| 29 |
- if out, _, err := dockerCmdWithError(c, "commit", containerName, repoAndTag); err != nil {
|
|
| 29 |
+ if out, _, err := dockerCmdWithError("commit", containerName, repoAndTag); err != nil {
|
|
| 30 | 30 |
return "", fmt.Errorf("image tagging failed: %s, %v", out, err)
|
| 31 | 31 |
} |
| 32 | 32 |
|
| ... | ... |
@@ -36,13 +36,13 @@ func setupImageWithTag(c *check.C, tag string) (string, error) {
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
// push the image |
| 39 |
- out, _, err := dockerCmdWithError(c, "push", repoAndTag) |
|
| 39 |
+ out, _, err := dockerCmdWithError("push", repoAndTag)
|
|
| 40 | 40 |
if err != nil {
|
| 41 | 41 |
return "", fmt.Errorf("pushing the image to the private registry has failed: %s, %v", out, err)
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 | 44 |
// delete our local repo that we previously tagged |
| 45 |
- if rmiout, _, err := dockerCmdWithError(c, "rmi", repoAndTag); err != nil {
|
|
| 45 |
+ if rmiout, _, err := dockerCmdWithError("rmi", repoAndTag); err != nil {
|
|
| 46 | 46 |
return "", fmt.Errorf("error deleting images prior to real test: %s, %v", rmiout, err)
|
| 47 | 47 |
} |
| 48 | 48 |
|
| ... | ... |
@@ -103,7 +103,7 @@ func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
|
| 103 | 103 |
func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
|
| 104 | 104 |
// pull from the registry using the <name>@<digest> reference |
| 105 | 105 |
imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
|
| 106 |
- out, _, err := dockerCmdWithError(c, "pull", imageReference) |
|
| 106 |
+ out, _, err := dockerCmdWithError("pull", imageReference)
|
|
| 107 | 107 |
if err == nil || !strings.Contains(out, "manifest unknown") {
|
| 108 | 108 |
c.Fatalf("expected non-zero exit status and correct error message when pulling non-existing image: %s", out)
|
| 109 | 109 |
} |
| ... | ... |
@@ -1369,7 +1369,7 @@ func pingContainers(c *check.C, d *Daemon, expectFailure bool) {
|
| 1369 | 1369 |
args = append(dargs, "run", "--rm", "--link", "container1:alias1", "busybox", "sh", "-c") |
| 1370 | 1370 |
pingCmd := "ping -c 1 %s -W 1" |
| 1371 | 1371 |
args = append(args, fmt.Sprintf(pingCmd, "alias1")) |
| 1372 |
- _, _, err := dockerCmdWithError(c, args...) |
|
| 1372 |
+ _, _, err := dockerCmdWithError(args...) |
|
| 1373 | 1373 |
|
| 1374 | 1374 |
if expectFailure {
|
| 1375 | 1375 |
c.Assert(err, check.NotNil) |
| ... | ... |
@@ -82,7 +82,7 @@ func (s *DockerSuite) TestDiffEnsureOnlyKmsgAndPtmx(c *check.C) {
|
| 82 | 82 |
|
| 83 | 83 |
// https://github.com/docker/docker/pull/14381#discussion_r33859347 |
| 84 | 84 |
func (s *DockerSuite) TestDiffEmptyArgClientError(c *check.C) {
|
| 85 |
- out, _, err := dockerCmdWithError(c, "diff", "") |
|
| 85 |
+ out, _, err := dockerCmdWithError("diff", "")
|
|
| 86 | 86 |
c.Assert(err, check.NotNil) |
| 87 | 87 |
c.Assert(strings.TrimSpace(out), check.Equals, "Container name cannot be empty") |
| 88 | 88 |
} |
| ... | ... |
@@ -75,7 +75,7 @@ func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) {
|
| 75 | 75 |
|
| 76 | 76 |
out, _ := dockerCmd(c, "images", "-q") |
| 77 | 77 |
image := strings.Split(out, "\n")[0] |
| 78 |
- if _, _, err := dockerCmdWithError(c, "run", "--name", "testeventdie", image, "blerg"); err == nil {
|
|
| 78 |
+ if _, _, err := dockerCmdWithError("run", "--name", "testeventdie", image, "blerg"); err == nil {
|
|
| 79 | 79 |
c.Fatalf("Container run with command blerg should have failed, but it did not")
|
| 80 | 80 |
} |
| 81 | 81 |
|
| ... | ... |
@@ -148,7 +148,7 @@ func (s *DockerSuite) TestExecPausedContainer(c *check.C) {
|
| 148 | 148 |
ContainerID := strings.TrimSpace(out) |
| 149 | 149 |
|
| 150 | 150 |
dockerCmd(c, "pause", "testing") |
| 151 |
- out, _, err := dockerCmdWithError(c, "exec", "-i", "-t", ContainerID, "echo", "hello") |
|
| 151 |
+ out, _, err := dockerCmdWithError("exec", "-i", "-t", ContainerID, "echo", "hello")
|
|
| 152 | 152 |
if err == nil {
|
| 153 | 153 |
c.Fatal("container should fail to exec new command if it is paused")
|
| 154 | 154 |
} |
| ... | ... |
@@ -268,7 +268,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) {
|
| 268 | 268 |
for i := 0; i < 5; i++ {
|
| 269 | 269 |
wg.Add(1) |
| 270 | 270 |
go func() {
|
| 271 |
- out, _, err := dockerCmdWithError(c, "exec", "testing", "cat", "/proc/self/cgroup") |
|
| 271 |
+ out, _, err := dockerCmdWithError("exec", "testing", "cat", "/proc/self/cgroup")
|
|
| 272 | 272 |
if err != nil {
|
| 273 | 273 |
errChan <- err |
| 274 | 274 |
return |
| ... | ... |
@@ -66,7 +66,7 @@ func (s *DockerSuite) TestHistoryExistentImage(c *check.C) {
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
func (s *DockerSuite) TestHistoryNonExistentImage(c *check.C) {
|
| 69 |
- _, _, err := dockerCmdWithError(c, "history", "testHistoryNonExistentImage") |
|
| 69 |
+ _, _, err := dockerCmdWithError("history", "testHistoryNonExistentImage")
|
|
| 70 | 70 |
if err == nil {
|
| 71 | 71 |
c.Fatal("history on a non-existent image should fail.")
|
| 72 | 72 |
} |
| ... | ... |
@@ -54,7 +54,7 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *check.C) {
|
| 57 |
- out, _, err := dockerCmdWithError(c, "images", "-f", "FOO=123") |
|
| 57 |
+ out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
|
|
| 58 | 58 |
if err == nil || !strings.Contains(out, "Invalid filter") {
|
| 59 | 59 |
c.Fatalf("error should occur when listing images with invalid filter name FOO, %s", out)
|
| 60 | 60 |
} |
| ... | ... |
@@ -34,7 +34,7 @@ func (s *DockerSuite) TestImportDisplay(c *check.C) {
|
| 34 | 34 |
} |
| 35 | 35 |
|
| 36 | 36 |
func (s *DockerSuite) TestImportBadURL(c *check.C) {
|
| 37 |
- out, _, err := dockerCmdWithError(c, "import", "http://nourl/bad") |
|
| 37 |
+ out, _, err := dockerCmdWithError("import", "http://nourl/bad")
|
|
| 38 | 38 |
if err == nil {
|
| 39 | 39 |
c.Fatal("import was supposed to fail but didn't")
|
| 40 | 40 |
} |
| ... | ... |
@@ -73,7 +73,7 @@ func (s *DockerSuite) TestImportFile(c *check.C) {
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
func (s *DockerSuite) TestImportFileNonExistentFile(c *check.C) {
|
| 76 |
- _, exitCode, err := dockerCmdWithError(c, "import", "example.com/myImage.tar") |
|
| 76 |
+ _, exitCode, err := dockerCmdWithError("import", "example.com/myImage.tar")
|
|
| 77 | 77 |
if exitCode == 0 || err == nil {
|
| 78 | 78 |
c.Fatalf("import non-existing file must failed")
|
| 79 | 79 |
} |
| ... | ... |
@@ -55,7 +55,7 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
|
| 55 | 55 |
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "top") |
| 56 | 56 |
|
| 57 | 57 |
formatStr := fmt.Sprintf("--format='{{.State.Running}}'")
|
| 58 |
- out, exitCode, err := dockerCmdWithError(c, "inspect", "--type=container", formatStr, "busybox") |
|
| 58 |
+ out, exitCode, err := dockerCmdWithError("inspect", "--type=container", formatStr, "busybox")
|
|
| 59 | 59 |
if exitCode != 0 || err != nil {
|
| 60 | 60 |
c.Fatalf("failed to inspect container: %s, %v", out, err)
|
| 61 | 61 |
} |
| ... | ... |
@@ -73,7 +73,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
|
| 73 | 73 |
|
| 74 | 74 |
dockerCmd(c, "run", "-d", "busybox", "true") |
| 75 | 75 |
|
| 76 |
- _, exitCode, err := dockerCmdWithError(c, "inspect", "--type=container", "busybox") |
|
| 76 |
+ _, exitCode, err := dockerCmdWithError("inspect", "--type=container", "busybox")
|
|
| 77 | 77 |
if exitCode == 0 || err == nil {
|
| 78 | 78 |
c.Fatalf("docker inspect should have failed, as there is no container named busybox")
|
| 79 | 79 |
} |
| ... | ... |
@@ -87,7 +87,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
|
| 87 | 87 |
|
| 88 | 88 |
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") |
| 89 | 89 |
|
| 90 |
- out, exitCode, err := dockerCmdWithError(c, "inspect", "--type=image", "busybox") |
|
| 90 |
+ out, exitCode, err := dockerCmdWithError("inspect", "--type=image", "busybox")
|
|
| 91 | 91 |
if exitCode != 0 || err != nil {
|
| 92 | 92 |
c.Fatalf("failed to inspect image: %s, %v", out, err)
|
| 93 | 93 |
} |
| ... | ... |
@@ -104,7 +104,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *check.C) {
|
| 104 | 104 |
|
| 105 | 105 |
dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true") |
| 106 | 106 |
|
| 107 |
- out, exitCode, err := dockerCmdWithError(c, "inspect", "--type=foobar", "busybox") |
|
| 107 |
+ out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox")
|
|
| 108 | 108 |
if exitCode != 0 || err != nil {
|
| 109 | 109 |
if !strings.Contains(out, "not a valid value for --type") {
|
| 110 | 110 |
c.Fatalf("failed to inspect image: %s, %v", out, err)
|
| ... | ... |
@@ -124,7 +124,7 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
|
| 124 | 124 |
|
| 125 | 125 |
//now see if the size turns out to be the same |
| 126 | 126 |
formatStr := fmt.Sprintf("--format='{{eq .Size %d}}'", size)
|
| 127 |
- out, exitCode, err := dockerCmdWithError(c, "inspect", formatStr, imageTest) |
|
| 127 |
+ out, exitCode, err := dockerCmdWithError("inspect", formatStr, imageTest)
|
|
| 128 | 128 |
if exitCode != 0 || err != nil {
|
| 129 | 129 |
c.Fatalf("failed to inspect image: %s, %v", out, err)
|
| 130 | 130 |
} |
| ... | ... |
@@ -25,7 +25,7 @@ func (s *DockerSuite) TestKillofStoppedContainer(c *check.C) {
|
| 25 | 25 |
|
| 26 | 26 |
dockerCmd(c, "stop", cleanedContainerID) |
| 27 | 27 |
|
| 28 |
- _, _, err := dockerCmdWithError(c, "kill", "-s", "30", cleanedContainerID) |
|
| 28 |
+ _, _, err := dockerCmdWithError("kill", "-s", "30", cleanedContainerID)
|
|
| 29 | 29 |
c.Assert(err, check.Not(check.IsNil), check.Commentf("Container %s is not running", cleanedContainerID))
|
| 30 | 30 |
} |
| 31 | 31 |
|
| ... | ... |
@@ -61,7 +61,7 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
|
| 61 | 61 |
cid := strings.TrimSpace(out) |
| 62 | 62 |
c.Assert(waitRun(cid), check.IsNil) |
| 63 | 63 |
|
| 64 |
- out, _, err := dockerCmdWithError(c, "kill", "-s", "0", cid) |
|
| 64 |
+ out, _, err := dockerCmdWithError("kill", "-s", "0", cid)
|
|
| 65 | 65 |
c.Assert(err, check.NotNil) |
| 66 | 66 |
if !strings.ContainsAny(out, "Invalid signal: 0") {
|
| 67 | 67 |
c.Fatal("Kill with an invalid signal didn't error out correctly")
|
| ... | ... |
@@ -76,7 +76,7 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
|
| 76 | 76 |
cid = strings.TrimSpace(out) |
| 77 | 77 |
c.Assert(waitRun(cid), check.IsNil) |
| 78 | 78 |
|
| 79 |
- out, _, err = dockerCmdWithError(c, "kill", "-s", "SIG42", cid) |
|
| 79 |
+ out, _, err = dockerCmdWithError("kill", "-s", "SIG42", cid)
|
|
| 80 | 80 |
c.Assert(err, check.NotNil) |
| 81 | 81 |
if !strings.ContainsAny(out, "Invalid signal: SIG42") {
|
| 82 | 82 |
c.Fatal("Kill with an invalid signal error out correctly")
|
| ... | ... |
@@ -11,7 +11,7 @@ import ( |
| 11 | 11 |
|
| 12 | 12 |
func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
|
| 13 | 13 |
|
| 14 |
- _, exitCode, err := dockerCmdWithError(c, "run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1") |
|
| 14 |
+ _, exitCode, err := dockerCmdWithError("run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
|
|
| 15 | 15 |
|
| 16 | 16 |
if exitCode == 0 {
|
| 17 | 17 |
c.Fatal("run ping did not fail")
|
| ... | ... |
@@ -24,7 +24,7 @@ func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
|
| 24 | 24 |
// Test for appropriate error when calling --link with an invalid target container |
| 25 | 25 |
func (s *DockerSuite) TestLinksInvalidContainerTarget(c *check.C) {
|
| 26 | 26 |
|
| 27 |
- out, _, err := dockerCmdWithError(c, "run", "--link", "bogus:alias", "busybox", "true") |
|
| 27 |
+ out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true")
|
|
| 28 | 28 |
|
| 29 | 29 |
if err == nil {
|
| 30 | 30 |
c.Fatal("an invalid container target should produce an error")
|
| ... | ... |
@@ -34,7 +34,7 @@ func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) {
|
| 34 | 34 |
|
| 35 | 35 |
func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
|
| 36 | 36 |
dockerCmd(c, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top") |
| 37 |
- out, _, err := dockerCmdWithError(c, "run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true") |
|
| 37 |
+ out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
|
|
| 38 | 38 |
if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") {
|
| 39 | 39 |
c.Fatalf("Running container linking to a container with --net host should have failed: %s", out)
|
| 40 | 40 |
} |
| ... | ... |
@@ -25,7 +25,7 @@ func (s *DockerSuite) TestPortHostBinding(c *check.C) {
|
| 25 | 25 |
|
| 26 | 26 |
dockerCmd(c, "rm", "-f", firstID) |
| 27 | 27 |
|
| 28 |
- if _, _, err := dockerCmdWithError(c, "run", "--net=host", "busybox", |
|
| 28 |
+ if _, _, err := dockerCmdWithError("run", "--net=host", "busybox",
|
|
| 29 | 29 |
"nc", "localhost", "9876"); err == nil {
|
| 30 | 30 |
c.Error("Port is still bound after the Container is removed")
|
| 31 | 31 |
} |
| ... | ... |
@@ -49,7 +49,7 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *check.C) {
|
| 49 | 49 |
|
| 50 | 50 |
dockerCmd(c, "rm", "-f", firstID) |
| 51 | 51 |
|
| 52 |
- if _, _, err = dockerCmdWithError(c, "run", "--net=host", "busybox", |
|
| 52 |
+ if _, _, err = dockerCmdWithError("run", "--net=host", "busybox",
|
|
| 53 | 53 |
"nc", "localhost", strings.TrimSpace(exposedPort)); err == nil {
|
| 54 | 54 |
c.Error("Port is still bound after the Container is removed")
|
| 55 | 55 |
} |
| ... | ... |
@@ -337,7 +337,7 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
|
| 337 | 337 |
c.Fatal(err) |
| 338 | 338 |
} |
| 339 | 339 |
|
| 340 |
- if out, _, err := dockerCmdWithError(c, "run", "--name", "nonzero1", "busybox", "false"); err == nil {
|
|
| 340 |
+ if out, _, err := dockerCmdWithError("run", "--name", "nonzero1", "busybox", "false"); err == nil {
|
|
| 341 | 341 |
c.Fatal("Should fail.", out, err)
|
| 342 | 342 |
} |
| 343 | 343 |
|
| ... | ... |
@@ -346,7 +346,7 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *check.C) {
|
| 346 | 346 |
c.Fatal(err) |
| 347 | 347 |
} |
| 348 | 348 |
|
| 349 |
- if out, _, err := dockerCmdWithError(c, "run", "--name", "nonzero2", "busybox", "false"); err == nil {
|
|
| 349 |
+ if out, _, err := dockerCmdWithError("run", "--name", "nonzero2", "busybox", "false"); err == nil {
|
|
| 350 | 350 |
c.Fatal("Should fail.", out, err)
|
| 351 | 351 |
} |
| 352 | 352 |
secondNonZero, err := getIDByName("nonzero2")
|
| ... | ... |
@@ -34,7 +34,7 @@ func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) {
|
| 34 | 34 |
dockerCmd(c, "pull", repos[0]) |
| 35 | 35 |
dockerCmd(c, "inspect", repos[0]) |
| 36 | 36 |
for _, repo := range repos[1:] {
|
| 37 |
- if _, _, err := dockerCmdWithError(c, "inspect", repo); err == nil {
|
|
| 37 |
+ if _, _, err := dockerCmdWithError("inspect", repo); err == nil {
|
|
| 38 | 38 |
c.Fatalf("Image %v shouldn't have been pulled down", repo)
|
| 39 | 39 |
} |
| 40 | 40 |
} |
| ... | ... |
@@ -51,7 +51,7 @@ func (s *DockerSuite) TestPullVerified(c *check.C) {
|
| 51 | 51 |
|
| 52 | 52 |
// pull it |
| 53 | 53 |
expected := "The image you are pulling has been verified" |
| 54 |
- if out, exitCode, err := dockerCmdWithError(c, "pull", verifiedName); err != nil || !strings.Contains(out, expected) {
|
|
| 54 |
+ if out, exitCode, err := dockerCmdWithError("pull", verifiedName); err != nil || !strings.Contains(out, expected) {
|
|
| 55 | 55 |
if err != nil || exitCode != 0 {
|
| 56 | 56 |
c.Skip(fmt.Sprintf("pulling the '%s' image from the registry has failed: %v", verifiedName, err))
|
| 57 | 57 |
} |
| ... | ... |
@@ -59,7 +59,7 @@ func (s *DockerSuite) TestPullVerified(c *check.C) {
|
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 | 61 |
// pull it again |
| 62 |
- if out, exitCode, err := dockerCmdWithError(c, "pull", verifiedName); err != nil || strings.Contains(out, expected) {
|
|
| 62 |
+ if out, exitCode, err := dockerCmdWithError("pull", verifiedName); err != nil || strings.Contains(out, expected) {
|
|
| 63 | 63 |
if err != nil || exitCode != 0 {
|
| 64 | 64 |
c.Skip(fmt.Sprintf("pulling the '%s' image from the registry has failed: %v", verifiedName, err))
|
| 65 | 65 |
} |
| ... | ... |
@@ -80,7 +80,7 @@ func (s *DockerSuite) TestPullNonExistingImage(c *check.C) {
|
| 80 | 80 |
testRequires(c, Network) |
| 81 | 81 |
|
| 82 | 82 |
name := "sadfsadfasdf" |
| 83 |
- out, _, err := dockerCmdWithError(c, "pull", name) |
|
| 83 |
+ out, _, err := dockerCmdWithError("pull", name)
|
|
| 84 | 84 |
|
| 85 | 85 |
if err == nil || !strings.Contains(out, fmt.Sprintf("Error: image library/%s:latest not found", name)) {
|
| 86 | 86 |
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) {
|
| 98 | 98 |
"index.docker.io/library/hello-world", |
| 99 | 99 |
} |
| 100 | 100 |
for _, name := range names {
|
| 101 |
- out, exitCode, err := dockerCmdWithError(c, "pull", name) |
|
| 101 |
+ out, exitCode, err := dockerCmdWithError("pull", name)
|
|
| 102 | 102 |
if err != nil || exitCode != 0 {
|
| 103 | 103 |
c.Errorf("pulling the '%s' image from the registry has failed: %s", name, err)
|
| 104 | 104 |
continue |
| ... | ... |
@@ -115,7 +115,7 @@ func (s *DockerSuite) TestPullImageOfficialNames(c *check.C) {
|
| 115 | 115 |
func (s *DockerSuite) TestPullScratchNotAllowed(c *check.C) {
|
| 116 | 116 |
testRequires(c, Network) |
| 117 | 117 |
|
| 118 |
- out, exitCode, err := dockerCmdWithError(c, "pull", "scratch") |
|
| 118 |
+ out, exitCode, err := dockerCmdWithError("pull", "scratch")
|
|
| 119 | 119 |
if err == nil {
|
| 120 | 120 |
c.Fatal("expected pull of scratch to fail, but it didn't")
|
| 121 | 121 |
} |
| ... | ... |
@@ -23,7 +23,7 @@ func (s *DockerRegistrySuite) TestPushBusyboxImage(c *check.C) {
|
| 23 | 23 |
|
| 24 | 24 |
// pushing an image without a prefix should throw an error |
| 25 | 25 |
func (s *DockerSuite) TestPushUnprefixedRepo(c *check.C) {
|
| 26 |
- if out, _, err := dockerCmdWithError(c, "push", "busybox"); err == nil {
|
|
| 26 |
+ if out, _, err := dockerCmdWithError("push", "busybox"); err == nil {
|
|
| 27 | 27 |
c.Fatalf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
|
| 28 | 28 |
} |
| 29 | 29 |
} |
| ... | ... |
@@ -32,7 +32,7 @@ func (s *DockerRegistrySuite) TestPushUntagged(c *check.C) {
|
| 32 | 32 |
repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
|
| 33 | 33 |
|
| 34 | 34 |
expected := "Repository does not exist" |
| 35 |
- if out, _, err := dockerCmdWithError(c, "push", repoName); err == nil {
|
|
| 35 |
+ if out, _, err := dockerCmdWithError("push", repoName); err == nil {
|
|
| 36 | 36 |
c.Fatalf("pushing the image to the private registry should have failed: output %q", out)
|
| 37 | 37 |
} else if !strings.Contains(out, expected) {
|
| 38 | 38 |
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) {
|
| 44 | 44 |
|
| 45 | 45 |
expected := "does not exist" |
| 46 | 46 |
|
| 47 |
- if out, _, err := dockerCmdWithError(c, "push", repoName); err == nil {
|
|
| 47 |
+ if out, _, err := dockerCmdWithError("push", repoName); err == nil {
|
|
| 48 | 48 |
c.Fatalf("pushing the image to the private registry should have failed: output %q", out)
|
| 49 | 49 |
} else if !strings.Contains(out, expected) {
|
| 50 | 50 |
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) {
|
| 103 | 103 |
if err := pushCmd.Process.Kill(); err != nil {
|
| 104 | 104 |
c.Fatalf("Failed to kill push process: %v", err)
|
| 105 | 105 |
} |
| 106 |
- if out, _, err := dockerCmdWithError(c, "push", repoName); err == nil {
|
|
| 106 |
+ if out, _, err := dockerCmdWithError("push", repoName); err == nil {
|
|
| 107 | 107 |
if !strings.Contains(out, "already in progress") {
|
| 108 | 108 |
c.Fatalf("Push should be continued on daemon side, but seems ok: %v, %s", err, out)
|
| 109 | 109 |
} |
| ... | ... |
@@ -139,7 +139,7 @@ func (s *DockerRegistrySuite) TestPushEmptyLayer(c *check.C) {
|
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 | 141 |
// Now verify we can push it |
| 142 |
- if out, _, err := dockerCmdWithError(c, "push", repoName); err != nil {
|
|
| 142 |
+ if out, _, err := dockerCmdWithError("push", repoName); err != nil {
|
|
| 143 | 143 |
c.Fatalf("pushing the image to the private registry has failed: %s, %v", out, err)
|
| 144 | 144 |
} |
| 145 | 145 |
} |
| ... | ... |
@@ -66,11 +66,11 @@ func (s *DockerSuite) TestRenameCheckNames(c *check.C) {
|
| 66 | 66 |
func (s *DockerSuite) TestRenameInvalidName(c *check.C) {
|
| 67 | 67 |
dockerCmd(c, "run", "--name", "myname", "-d", "busybox", "top") |
| 68 | 68 |
|
| 69 |
- if out, _, err := dockerCmdWithError(c, "rename", "myname", "new:invalid"); err == nil || !strings.Contains(out, "Invalid container name") {
|
|
| 69 |
+ if out, _, err := dockerCmdWithError("rename", "myname", "new:invalid"); err == nil || !strings.Contains(out, "Invalid container name") {
|
|
| 70 | 70 |
c.Fatalf("Renaming container to invalid name should have failed: %s\n%v", out, err)
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 |
- if out, _, err := dockerCmdWithError(c, "ps", "-a"); err != nil || !strings.Contains(out, "myname") {
|
|
| 73 |
+ if out, _, err := dockerCmdWithError("ps", "-a"); err != nil || !strings.Contains(out, "myname") {
|
|
| 74 | 74 |
c.Fatalf("Output of docker ps should have included 'myname': %s\n%v", out, err)
|
| 75 | 75 |
} |
| 76 | 76 |
} |
| ... | ... |
@@ -28,7 +28,7 @@ func (s *DockerSuite) TestRmContainerWithVolume(c *check.C) {
|
| 28 | 28 |
func (s *DockerSuite) TestRmRunningContainer(c *check.C) {
|
| 29 | 29 |
createRunningContainer(c, "foo") |
| 30 | 30 |
|
| 31 |
- if _, _, err := dockerCmdWithError(c, "rm", "foo"); err == nil {
|
|
| 31 |
+ if _, _, err := dockerCmdWithError("rm", "foo"); err == nil {
|
|
| 32 | 32 |
c.Fatalf("Expected error, can't rm a running container")
|
| 33 | 33 |
} |
| 34 | 34 |
} |
| ... | ... |
@@ -55,7 +55,7 @@ func (s *DockerSuite) TestRmContainerOrphaning(c *check.C) {
|
| 55 | 55 |
c.Fatalf("Could not build image %s: %v", img, err)
|
| 56 | 56 |
} |
| 57 | 57 |
// run container on first image |
| 58 |
- if out, _, err := dockerCmdWithError(c, "run", img); err != nil {
|
|
| 58 |
+ if out, _, err := dockerCmdWithError("run", img); err != nil {
|
|
| 59 | 59 |
c.Fatalf("Could not run image %s: %v: %s", img, err, out)
|
| 60 | 60 |
} |
| 61 | 61 |
|
| ... | ... |
@@ -64,12 +64,12 @@ func (s *DockerSuite) TestRmContainerOrphaning(c *check.C) {
|
| 64 | 64 |
c.Fatalf("Could not rebuild image %s: %v", img, err)
|
| 65 | 65 |
} |
| 66 | 66 |
// try to remove the image, should error out. |
| 67 |
- if out, _, err := dockerCmdWithError(c, "rmi", img); err == nil {
|
|
| 67 |
+ if out, _, err := dockerCmdWithError("rmi", img); err == nil {
|
|
| 68 | 68 |
c.Fatalf("Expected to error out removing the image, but succeeded: %s", out)
|
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
// check if we deleted the first image |
| 72 |
- out, _, err := dockerCmdWithError(c, "images", "-q", "--no-trunc") |
|
| 72 |
+ out, _, err := dockerCmdWithError("images", "-q", "--no-trunc")
|
|
| 73 | 73 |
if err != nil {
|
| 74 | 74 |
c.Fatalf("%v: %s", err, out)
|
| 75 | 75 |
} |
| ... | ... |
@@ -79,7 +79,7 @@ func (s *DockerSuite) TestRmContainerOrphaning(c *check.C) {
|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
func (s *DockerSuite) TestRmInvalidContainer(c *check.C) {
|
| 82 |
- if out, _, err := dockerCmdWithError(c, "rm", "unknown"); err == nil {
|
|
| 82 |
+ if out, _, err := dockerCmdWithError("rm", "unknown"); err == nil {
|
|
| 83 | 83 |
c.Fatal("Expected error on rm unknown container, got none")
|
| 84 | 84 |
} else if !strings.Contains(out, "failed to remove containers") {
|
| 85 | 85 |
c.Fatalf("Expected output to contain 'failed to remove containers', got %q", out)
|
| ... | ... |
@@ -12,7 +12,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
|
| 12 | 12 |
errSubstr := "is using it" |
| 13 | 13 |
|
| 14 | 14 |
// create a container |
| 15 |
- out, _, err := dockerCmdWithError(c, "run", "-d", "busybox", "true") |
|
| 15 |
+ out, _, err := dockerCmdWithError("run", "-d", "busybox", "true")
|
|
| 16 | 16 |
if err != nil {
|
| 17 | 17 |
c.Fatalf("failed to create a container: %s, %v", out, err)
|
| 18 | 18 |
} |
| ... | ... |
@@ -20,7 +20,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
|
| 20 | 20 |
cleanedContainerID := strings.TrimSpace(out) |
| 21 | 21 |
|
| 22 | 22 |
// try to delete the image |
| 23 |
- out, _, err = dockerCmdWithError(c, "rmi", "busybox") |
|
| 23 |
+ out, _, err = dockerCmdWithError("rmi", "busybox")
|
|
| 24 | 24 |
if err == nil {
|
| 25 | 25 |
c.Fatalf("Container %q is using image, should not be able to rmi: %q", cleanedContainerID, out)
|
| 26 | 26 |
} |
| ... | ... |
@@ -73,13 +73,13 @@ func (s *DockerSuite) TestRmiTag(c *check.C) {
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 | 75 |
func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
|
| 76 |
- out, _, err := dockerCmdWithError(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-one'") |
|
| 76 |
+ out, _, err := dockerCmdWithError("run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-one'")
|
|
| 77 | 77 |
if err != nil {
|
| 78 | 78 |
c.Fatalf("failed to create a container:%s, %v", out, err)
|
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
containerID := strings.TrimSpace(out) |
| 82 |
- out, _, err = dockerCmdWithError(c, "commit", containerID, "busybox-one") |
|
| 82 |
+ out, _, err = dockerCmdWithError("commit", containerID, "busybox-one")
|
|
| 83 | 83 |
if err != nil {
|
| 84 | 84 |
c.Fatalf("failed to commit a new busybox-one:%s, %v", out, err)
|
| 85 | 85 |
} |
| ... | ... |
@@ -97,7 +97,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
|
| 97 | 97 |
c.Assert(err, check.IsNil) |
| 98 | 98 |
|
| 99 | 99 |
// run a container with the image |
| 100 |
- out, _, err = dockerCmdWithError(c, "run", "-d", "busybox-one", "top") |
|
| 100 |
+ out, _, err = dockerCmdWithError("run", "-d", "busybox-one", "top")
|
|
| 101 | 101 |
if err != nil {
|
| 102 | 102 |
c.Fatalf("failed to create a container:%s, %v", out, err)
|
| 103 | 103 |
} |
| ... | ... |
@@ -105,7 +105,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
|
| 105 | 105 |
containerID = strings.TrimSpace(out) |
| 106 | 106 |
|
| 107 | 107 |
// first checkout without force it fails |
| 108 |
- out, _, err = dockerCmdWithError(c, "rmi", imgID) |
|
| 108 |
+ out, _, err = dockerCmdWithError("rmi", imgID)
|
|
| 109 | 109 |
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])
|
| 110 | 110 |
if err == nil || !strings.Contains(out, expected) {
|
| 111 | 111 |
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) {
|
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 | 123 |
func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
|
| 124 |
- out, _, err := dockerCmdWithError(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-test'") |
|
| 124 |
+ out, _, err := dockerCmdWithError("run", "-d", "busybox", "/bin/sh", "-c", "mkdir '/busybox-test'")
|
|
| 125 | 125 |
if err != nil {
|
| 126 | 126 |
c.Fatalf("failed to create a container:%s, %v", out, err)
|
| 127 | 127 |
} |
| 128 | 128 |
|
| 129 | 129 |
containerID := strings.TrimSpace(out) |
| 130 |
- out, _, err = dockerCmdWithError(c, "commit", containerID, "busybox-test") |
|
| 130 |
+ out, _, err = dockerCmdWithError("commit", containerID, "busybox-test")
|
|
| 131 | 131 |
if err != nil {
|
| 132 | 132 |
c.Fatalf("failed to commit a new busybox-test:%s, %v", out, err)
|
| 133 | 133 |
} |
| ... | ... |
@@ -147,7 +147,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) {
|
| 147 | 147 |
c.Assert(err, check.IsNil) |
| 148 | 148 |
|
| 149 | 149 |
// first checkout without force it fails |
| 150 |
- out, _, err = dockerCmdWithError(c, "rmi", imgID) |
|
| 150 |
+ out, _, err = dockerCmdWithError("rmi", imgID)
|
|
| 151 | 151 |
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)) {
|
| 152 | 152 |
c.Fatalf("rmi tagged in multiple repos should have failed without force:%s, %v", out, err)
|
| 153 | 153 |
} |
| ... | ... |
@@ -171,7 +171,7 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c |
| 171 | 171 |
dockerCmd(c, "tag", imgID, newTag) |
| 172 | 172 |
dockerCmd(c, "run", "-d", imgID, "top") |
| 173 | 173 |
|
| 174 |
- out, _, err := dockerCmdWithError(c, "rmi", "-f", imgID) |
|
| 174 |
+ out, _, err := dockerCmdWithError("rmi", "-f", imgID)
|
|
| 175 | 175 |
if err == nil || !strings.Contains(out, "stop it and retry") {
|
| 176 | 176 |
c.Log(out) |
| 177 | 177 |
c.Fatalf("rmi -f should not delete image with running containers")
|
| ... | ... |
@@ -182,13 +182,13 @@ func (s *DockerSuite) TestRmiTagWithExistingContainers(c *check.C) {
|
| 182 | 182 |
container := "test-delete-tag" |
| 183 | 183 |
newtag := "busybox:newtag" |
| 184 | 184 |
bb := "busybox:latest" |
| 185 |
- if out, _, err := dockerCmdWithError(c, "tag", bb, newtag); err != nil {
|
|
| 185 |
+ if out, _, err := dockerCmdWithError("tag", bb, newtag); err != nil {
|
|
| 186 | 186 |
c.Fatalf("Could not tag busybox: %v: %s", err, out)
|
| 187 | 187 |
} |
| 188 |
- if out, _, err := dockerCmdWithError(c, "run", "--name", container, bb, "/bin/true"); err != nil {
|
|
| 188 |
+ if out, _, err := dockerCmdWithError("run", "--name", container, bb, "/bin/true"); err != nil {
|
|
| 189 | 189 |
c.Fatalf("Could not run busybox: %v: %s", err, out)
|
| 190 | 190 |
} |
| 191 |
- out, _, err := dockerCmdWithError(c, "rmi", newtag) |
|
| 191 |
+ out, _, err := dockerCmdWithError("rmi", newtag)
|
|
| 192 | 192 |
if err != nil {
|
| 193 | 193 |
c.Fatalf("Could not remove tag %s: %v: %s", newtag, err, out)
|
| 194 | 194 |
} |
| ... | ... |
@@ -208,11 +208,11 @@ MAINTAINER foo`) |
| 208 | 208 |
c.Fatalf("Could not build %s: %s, %v", image, out, err)
|
| 209 | 209 |
} |
| 210 | 210 |
|
| 211 |
- if out, _, err := dockerCmdWithError(c, "run", "--name", "test-force-rmi", image, "/bin/true"); err != nil {
|
|
| 211 |
+ if out, _, err := dockerCmdWithError("run", "--name", "test-force-rmi", image, "/bin/true"); err != nil {
|
|
| 212 | 212 |
c.Fatalf("Could not run container: %s, %v", out, err)
|
| 213 | 213 |
} |
| 214 | 214 |
|
| 215 |
- if out, _, err := dockerCmdWithError(c, "rmi", "-f", image); err != nil {
|
|
| 215 |
+ if out, _, err := dockerCmdWithError("rmi", "-f", image); err != nil {
|
|
| 216 | 216 |
c.Fatalf("Could not remove image %s: %s, %v", image, out, err)
|
| 217 | 217 |
} |
| 218 | 218 |
} |
| ... | ... |
@@ -221,22 +221,22 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
|
| 221 | 221 |
newRepo := "127.0.0.1:5000/busybox" |
| 222 | 222 |
oldRepo := "busybox" |
| 223 | 223 |
newTag := "busybox:test" |
| 224 |
- out, _, err := dockerCmdWithError(c, "tag", oldRepo, newRepo) |
|
| 224 |
+ out, _, err := dockerCmdWithError("tag", oldRepo, newRepo)
|
|
| 225 | 225 |
if err != nil {
|
| 226 | 226 |
c.Fatalf("Could not tag busybox: %v: %s", err, out)
|
| 227 | 227 |
} |
| 228 | 228 |
|
| 229 |
- out, _, err = dockerCmdWithError(c, "run", "--name", "test", oldRepo, "touch", "/home/abcd") |
|
| 229 |
+ out, _, err = dockerCmdWithError("run", "--name", "test", oldRepo, "touch", "/home/abcd")
|
|
| 230 | 230 |
if err != nil {
|
| 231 | 231 |
c.Fatalf("failed to run container: %v, output: %s", err, out)
|
| 232 | 232 |
} |
| 233 | 233 |
|
| 234 |
- out, _, err = dockerCmdWithError(c, "commit", "test", newTag) |
|
| 234 |
+ out, _, err = dockerCmdWithError("commit", "test", newTag)
|
|
| 235 | 235 |
if err != nil {
|
| 236 | 236 |
c.Fatalf("failed to commit container: %v, output: %s", err, out)
|
| 237 | 237 |
} |
| 238 | 238 |
|
| 239 |
- out, _, err = dockerCmdWithError(c, "rmi", newTag) |
|
| 239 |
+ out, _, err = dockerCmdWithError("rmi", newTag)
|
|
| 240 | 240 |
if err != nil {
|
| 241 | 241 |
c.Fatalf("failed to remove image: %v, output: %s", err, out)
|
| 242 | 242 |
} |
| ... | ... |
@@ -247,7 +247,7 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *check.C) {
|
| 247 | 247 |
|
| 248 | 248 |
func (s *DockerSuite) TestRmiBlank(c *check.C) {
|
| 249 | 249 |
// try to delete a blank image name |
| 250 |
- out, _, err := dockerCmdWithError(c, "rmi", "") |
|
| 250 |
+ out, _, err := dockerCmdWithError("rmi", "")
|
|
| 251 | 251 |
if err == nil {
|
| 252 | 252 |
c.Fatal("Should have failed to delete '' image")
|
| 253 | 253 |
} |
| ... | ... |
@@ -258,7 +258,7 @@ func (s *DockerSuite) TestRmiBlank(c *check.C) {
|
| 258 | 258 |
c.Fatalf("Expected error message not generated: %s", out)
|
| 259 | 259 |
} |
| 260 | 260 |
|
| 261 |
- out, _, err = dockerCmdWithError(c, "rmi", " ") |
|
| 261 |
+ out, _, err = dockerCmdWithError("rmi", " ")
|
|
| 262 | 262 |
if err == nil {
|
| 263 | 263 |
c.Fatal("Should have failed to delete '' image")
|
| 264 | 264 |
} |
| ... | ... |
@@ -286,7 +286,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
|
| 286 | 286 |
dockerCmd(c, "rmi", "-f", imageIds[1]) |
| 287 | 287 |
|
| 288 | 288 |
// Try to remove the image of the running container and see if it fails as expected. |
| 289 |
- out, _, err := dockerCmdWithError(c, "rmi", "-f", imageIds[0]) |
|
| 289 |
+ out, _, err := dockerCmdWithError("rmi", "-f", imageIds[0])
|
|
| 290 | 290 |
if err == nil || !strings.Contains(out, "is using it") {
|
| 291 | 291 |
c.Log(out) |
| 292 | 292 |
c.Fatal("The image of the running container should not be removed.")
|
| ... | ... |
@@ -52,7 +52,7 @@ func (s *DockerSuite) TestRunWithSwappiness(c *check.C) {
|
| 52 | 52 |
} |
| 53 | 53 |
|
| 54 | 54 |
func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) {
|
| 55 |
- out, _, err := dockerCmdWithError(c, "run", "--memory-swappiness", "101", "busybox", "true") |
|
| 55 |
+ out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true")
|
|
| 56 | 56 |
if err == nil {
|
| 57 | 57 |
c.Fatalf("failed. test was able to set invalid value, output: %q", out)
|
| 58 | 58 |
} |
| ... | ... |
@@ -108,7 +108,7 @@ func (s *DockerSuite) TestRunExitCodeZero(c *check.C) {
|
| 108 | 108 |
// the exit code should be 1 |
| 109 | 109 |
// some versions of lxc might make this test fail |
| 110 | 110 |
func (s *DockerSuite) TestRunExitCodeOne(c *check.C) {
|
| 111 |
- _, exitCode, err := dockerCmdWithError(c, "run", "busybox", "false") |
|
| 111 |
+ _, exitCode, err := dockerCmdWithError("run", "busybox", "false")
|
|
| 112 | 112 |
if err != nil && !strings.Contains("exit status 1", fmt.Sprintf("%s", err)) {
|
| 113 | 113 |
c.Fatal(err) |
| 114 | 114 |
} |
| ... | ... |
@@ -173,7 +173,7 @@ func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) {
|
| 173 | 173 |
|
| 174 | 174 |
// pinging Google's DNS resolver should fail when we disable the networking |
| 175 | 175 |
func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
|
| 176 |
- out, exitCode, err := dockerCmdWithError(c, "run", "--net=none", "busybox", "ping", "-c", "1", "8.8.8.8") |
|
| 176 |
+ out, exitCode, err := dockerCmdWithError("run", "--net=none", "busybox", "ping", "-c", "1", "8.8.8.8")
|
|
| 177 | 177 |
if err != nil && exitCode != 1 {
|
| 178 | 178 |
c.Fatal(out, err) |
| 179 | 179 |
} |
| ... | ... |
@@ -181,7 +181,7 @@ func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) {
|
| 181 | 181 |
c.Errorf("--net=none should've disabled the network; the container shouldn't have been able to ping 8.8.8.8")
|
| 182 | 182 |
} |
| 183 | 183 |
|
| 184 |
- out, exitCode, err = dockerCmdWithError(c, "run", "-n=false", "busybox", "ping", "-c", "1", "8.8.8.8") |
|
| 184 |
+ out, exitCode, err = dockerCmdWithError("run", "-n=false", "busybox", "ping", "-c", "1", "8.8.8.8")
|
|
| 185 | 185 |
if err != nil && exitCode != 1 {
|
| 186 | 186 |
c.Fatal(out, err) |
| 187 | 187 |
} |
| ... | ... |
@@ -219,7 +219,7 @@ func (s *DockerSuite) TestRunLinksContainerWithContainerId(c *check.C) {
|
| 219 | 219 |
|
| 220 | 220 |
// Issue 9677. |
| 221 | 221 |
func (s *DockerSuite) TestRunWithDaemonFlags(c *check.C) {
|
| 222 |
- out, _, err := dockerCmdWithError(c, "--selinux-enabled", "run", "-i", "-t", "busybox", "true") |
|
| 222 |
+ out, _, err := dockerCmdWithError("--selinux-enabled", "run", "-i", "-t", "busybox", "true")
|
|
| 223 | 223 |
if err != nil {
|
| 224 | 224 |
if !strings.Contains(out, "must follow the 'docker daemon' command") && // daemon |
| 225 | 225 |
!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) {
|
| 269 | 269 |
} |
| 270 | 270 |
|
| 271 | 271 |
func (s *DockerSuite) TestRunVolumesMountedAsReadonly(c *check.C) {
|
| 272 |
- if _, code, err := dockerCmdWithError(c, "run", "-v", "/test:/test:ro", "busybox", "touch", "/test/somefile"); err == nil || code == 0 {
|
|
| 272 |
+ if _, code, err := dockerCmdWithError("run", "-v", "/test:/test:ro", "busybox", "touch", "/test/somefile"); err == nil || code == 0 {
|
|
| 273 | 273 |
c.Fatalf("run should fail because volume is ro: exit code %d", code)
|
| 274 | 274 |
} |
| 275 | 275 |
} |
| ... | ... |
@@ -277,7 +277,7 @@ func (s *DockerSuite) TestRunVolumesMountedAsReadonly(c *check.C) {
|
| 277 | 277 |
func (s *DockerSuite) TestRunVolumesFromInReadonlyMode(c *check.C) {
|
| 278 | 278 |
dockerCmd(c, "run", "--name", "parent", "-v", "/test", "busybox", "true") |
| 279 | 279 |
|
| 280 |
- if _, code, err := dockerCmdWithError(c, "run", "--volumes-from", "parent:ro", "busybox", "touch", "/test/file"); err == nil || code == 0 {
|
|
| 280 |
+ if _, code, err := dockerCmdWithError("run", "--volumes-from", "parent:ro", "busybox", "touch", "/test/file"); err == nil || code == 0 {
|
|
| 281 | 281 |
c.Fatalf("run should fail because volume is ro: exit code %d", code)
|
| 282 | 282 |
} |
| 283 | 283 |
} |
| ... | ... |
@@ -287,7 +287,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) {
|
| 287 | 287 |
dockerCmd(c, "run", "--name", "parent", "-v", "/test", "busybox", "true") |
| 288 | 288 |
dockerCmd(c, "run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file") |
| 289 | 289 |
|
| 290 |
- 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") {
|
|
| 290 |
+ if out, _, err := dockerCmdWithError("run", "--volumes-from", "parent:bar", "busybox", "touch", "/test/file"); err == nil || !strings.Contains(out, "invalid mode for volumes-from: bar") {
|
|
| 291 | 291 |
c.Fatalf("running --volumes-from foo:bar should have failed with invalid mount mode: %q", out)
|
| 292 | 292 |
} |
| 293 | 293 |
|
| ... | ... |
@@ -298,14 +298,14 @@ func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) {
|
| 298 | 298 |
dockerCmd(c, "run", "--name", "parent", "-v", "/test:/test:ro", "busybox", "true") |
| 299 | 299 |
|
| 300 | 300 |
// Expect this "rw" mode to be be ignored since the inherited volume is "ro" |
| 301 |
- if _, _, err := dockerCmdWithError(c, "run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file"); err == nil {
|
|
| 301 |
+ if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file"); err == nil {
|
|
| 302 | 302 |
c.Fatal("Expected volumes-from to inherit read-only volume even when passing in `rw`")
|
| 303 | 303 |
} |
| 304 | 304 |
|
| 305 | 305 |
dockerCmd(c, "run", "--name", "parent2", "-v", "/test:/test:ro", "busybox", "true") |
| 306 | 306 |
|
| 307 | 307 |
// Expect this to be read-only since both are "ro" |
| 308 |
- if _, _, err := dockerCmdWithError(c, "run", "--volumes-from", "parent2:ro", "busybox", "touch", "/test/file"); err == nil {
|
|
| 308 |
+ if _, _, err := dockerCmdWithError("run", "--volumes-from", "parent2:ro", "busybox", "touch", "/test/file"); err == nil {
|
|
| 309 | 309 |
c.Fatal("Expected volumes-from to inherit read-only volume even when passing in `ro`")
|
| 310 | 310 |
} |
| 311 | 311 |
} |
| ... | ... |
@@ -315,7 +315,7 @@ func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) {
|
| 315 | 315 |
mountstr1 := randomUnixTmpDirPath("test1") + ":/someplace"
|
| 316 | 316 |
mountstr2 := randomUnixTmpDirPath("test2") + ":/someplace"
|
| 317 | 317 |
|
| 318 |
- if out, _, err := dockerCmdWithError(c, "run", "-v", mountstr1, "-v", mountstr2, "busybox", "true"); err == nil {
|
|
| 318 |
+ if out, _, err := dockerCmdWithError("run", "-v", mountstr1, "-v", mountstr2, "busybox", "true"); err == nil {
|
|
| 319 | 319 |
c.Fatal("Expected error about duplicate volume definitions")
|
| 320 | 320 |
} else {
|
| 321 | 321 |
if !strings.Contains(out, "Duplicate bind mount") {
|
| ... | ... |
@@ -338,7 +338,7 @@ func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) {
|
| 338 | 338 |
|
| 339 | 339 |
// this tests verifies the ID format for the container |
| 340 | 340 |
func (s *DockerSuite) TestRunVerifyContainerID(c *check.C) {
|
| 341 |
- out, exit, err := dockerCmdWithError(c, "run", "-d", "busybox", "true") |
|
| 341 |
+ out, exit, err := dockerCmdWithError("run", "-d", "busybox", "true")
|
|
| 342 | 342 |
if err != nil {
|
| 343 | 343 |
c.Fatal(err) |
| 344 | 344 |
} |
| ... | ... |
@@ -374,7 +374,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
|
| 374 | 374 |
c.Fatalf("could not build '%s': %v", image, err)
|
| 375 | 375 |
} |
| 376 | 376 |
|
| 377 |
- _, exitCode, err := dockerCmdWithError(c, "run", "-v", "/bar/foo", "--name", "test-createvolumewithsymlink", image, "sh", "-c", "mount | grep -q /home/foo") |
|
| 377 |
+ _, exitCode, err := dockerCmdWithError("run", "-v", "/bar/foo", "--name", "test-createvolumewithsymlink", image, "sh", "-c", "mount | grep -q /home/foo")
|
|
| 378 | 378 |
if err != nil || exitCode != 0 {
|
| 379 | 379 |
c.Fatalf("[run] err: %v, exitcode: %d", err, exitCode)
|
| 380 | 380 |
} |
| ... | ... |
@@ -384,7 +384,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
|
| 384 | 384 |
c.Fatalf("[inspect] err: %v", err)
|
| 385 | 385 |
} |
| 386 | 386 |
|
| 387 |
- _, exitCode, err = dockerCmdWithError(c, "rm", "-v", "test-createvolumewithsymlink") |
|
| 387 |
+ _, exitCode, err = dockerCmdWithError("rm", "-v", "test-createvolumewithsymlink")
|
|
| 388 | 388 |
if err != nil || exitCode != 0 {
|
| 389 | 389 |
c.Fatalf("[rm] err: %v, exitcode: %d", err, exitCode)
|
| 390 | 390 |
} |
| ... | ... |
@@ -409,19 +409,19 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) {
|
| 409 | 409 |
c.Fatalf("could not build 'docker-test-volumesfromsymlinkpath': %v", err)
|
| 410 | 410 |
} |
| 411 | 411 |
|
| 412 |
- _, exitCode, err := dockerCmdWithError(c, "run", "--name", "test-volumesfromsymlinkpath", name) |
|
| 412 |
+ _, exitCode, err := dockerCmdWithError("run", "--name", "test-volumesfromsymlinkpath", name)
|
|
| 413 | 413 |
if err != nil || exitCode != 0 {
|
| 414 | 414 |
c.Fatalf("[run] (volume) err: %v, exitcode: %d", err, exitCode)
|
| 415 | 415 |
} |
| 416 | 416 |
|
| 417 |
- _, exitCode, err = dockerCmdWithError(c, "run", "--volumes-from", "test-volumesfromsymlinkpath", "busybox", "sh", "-c", "ls /foo | grep -q bar") |
|
| 417 |
+ _, exitCode, err = dockerCmdWithError("run", "--volumes-from", "test-volumesfromsymlinkpath", "busybox", "sh", "-c", "ls /foo | grep -q bar")
|
|
| 418 | 418 |
if err != nil || exitCode != 0 {
|
| 419 | 419 |
c.Fatalf("[run] err: %v, exitcode: %d", err, exitCode)
|
| 420 | 420 |
} |
| 421 | 421 |
} |
| 422 | 422 |
|
| 423 | 423 |
func (s *DockerSuite) TestRunExitCode(c *check.C) {
|
| 424 |
- _, exit, err := dockerCmdWithError(c, "run", "busybox", "/bin/sh", "-c", "exit 72") |
|
| 424 |
+ _, exit, err := dockerCmdWithError("run", "busybox", "/bin/sh", "-c", "exit 72")
|
|
| 425 | 425 |
if err == nil {
|
| 426 | 426 |
c.Fatal("should not have a non nil error")
|
| 427 | 427 |
} |
| ... | ... |
@@ -452,7 +452,7 @@ func (s *DockerSuite) TestRunUserByID(c *check.C) {
|
| 452 | 452 |
} |
| 453 | 453 |
|
| 454 | 454 |
func (s *DockerSuite) TestRunUserByIDBig(c *check.C) {
|
| 455 |
- out, _, err := dockerCmdWithError(c, "run", "-u", "2147483648", "busybox", "id") |
|
| 455 |
+ out, _, err := dockerCmdWithError("run", "-u", "2147483648", "busybox", "id")
|
|
| 456 | 456 |
if err == nil {
|
| 457 | 457 |
c.Fatal("No error, but must be.", out)
|
| 458 | 458 |
} |
| ... | ... |
@@ -462,7 +462,7 @@ func (s *DockerSuite) TestRunUserByIDBig(c *check.C) {
|
| 462 | 462 |
} |
| 463 | 463 |
|
| 464 | 464 |
func (s *DockerSuite) TestRunUserByIDNegative(c *check.C) {
|
| 465 |
- out, _, err := dockerCmdWithError(c, "run", "-u", "-1", "busybox", "id") |
|
| 465 |
+ out, _, err := dockerCmdWithError("run", "-u", "-1", "busybox", "id")
|
|
| 466 | 466 |
if err == nil {
|
| 467 | 467 |
c.Fatal("No error, but must be.", out)
|
| 468 | 468 |
} |
| ... | ... |
@@ -472,7 +472,7 @@ func (s *DockerSuite) TestRunUserByIDNegative(c *check.C) {
|
| 472 | 472 |
} |
| 473 | 473 |
|
| 474 | 474 |
func (s *DockerSuite) TestRunUserByIDZero(c *check.C) {
|
| 475 |
- out, _, err := dockerCmdWithError(c, "run", "-u", "0", "busybox", "id") |
|
| 475 |
+ out, _, err := dockerCmdWithError("run", "-u", "0", "busybox", "id")
|
|
| 476 | 476 |
if err != nil {
|
| 477 | 477 |
c.Fatal(err, out) |
| 478 | 478 |
} |
| ... | ... |
@@ -482,7 +482,7 @@ func (s *DockerSuite) TestRunUserByIDZero(c *check.C) {
|
| 482 | 482 |
} |
| 483 | 483 |
|
| 484 | 484 |
func (s *DockerSuite) TestRunUserNotFound(c *check.C) {
|
| 485 |
- _, _, err := dockerCmdWithError(c, "run", "-u", "notme", "busybox", "id") |
|
| 485 |
+ _, _, err := dockerCmdWithError("run", "-u", "notme", "busybox", "id")
|
|
| 486 | 486 |
if err == nil {
|
| 487 | 487 |
c.Fatal("unknown user should cause container to fail")
|
| 488 | 488 |
} |
| ... | ... |
@@ -496,7 +496,7 @@ func (s *DockerSuite) TestRunTwoConcurrentContainers(c *check.C) {
|
| 496 | 496 |
for i := 0; i < 2; i++ {
|
| 497 | 497 |
go func() {
|
| 498 | 498 |
defer group.Done() |
| 499 |
- _, _, err := dockerCmdWithError(c, "run", "busybox", "sleep", "2") |
|
| 499 |
+ _, _, err := dockerCmdWithError("run", "busybox", "sleep", "2")
|
|
| 500 | 500 |
errChan <- err |
| 501 | 501 |
}() |
| 502 | 502 |
} |
| ... | ... |
@@ -632,7 +632,7 @@ func (s *DockerSuite) TestRunContainerNetwork(c *check.C) {
|
| 632 | 632 |
func (s *DockerSuite) TestRunNetHostNotAllowedWithLinks(c *check.C) {
|
| 633 | 633 |
dockerCmd(c, "run", "--name", "linked", "busybox", "true") |
| 634 | 634 |
|
| 635 |
- _, _, err := dockerCmdWithError(c, "run", "--net=host", "--link", "linked:linked", "busybox", "true") |
|
| 635 |
+ _, _, err := dockerCmdWithError("run", "--net=host", "--link", "linked:linked", "busybox", "true")
|
|
| 636 | 636 |
if err == nil {
|
| 637 | 637 |
c.Fatal("Expected error")
|
| 638 | 638 |
} |
| ... | ... |
@@ -665,14 +665,14 @@ func (s *DockerSuite) TestRunUnprivilegedCanMknod(c *check.C) {
|
| 665 | 665 |
} |
| 666 | 666 |
|
| 667 | 667 |
func (s *DockerSuite) TestRunCapDropInvalid(c *check.C) {
|
| 668 |
- out, _, err := dockerCmdWithError(c, "run", "--cap-drop=CHPASS", "busybox", "ls") |
|
| 668 |
+ out, _, err := dockerCmdWithError("run", "--cap-drop=CHPASS", "busybox", "ls")
|
|
| 669 | 669 |
if err == nil {
|
| 670 | 670 |
c.Fatal(err, out) |
| 671 | 671 |
} |
| 672 | 672 |
} |
| 673 | 673 |
|
| 674 | 674 |
func (s *DockerSuite) TestRunCapDropCannotMknod(c *check.C) {
|
| 675 |
- out, _, err := dockerCmdWithError(c, "run", "--cap-drop=MKNOD", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok") |
|
| 675 |
+ out, _, err := dockerCmdWithError("run", "--cap-drop=MKNOD", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
|
|
| 676 | 676 |
|
| 677 | 677 |
if err == nil {
|
| 678 | 678 |
c.Fatal(err, out) |
| ... | ... |
@@ -683,7 +683,7 @@ func (s *DockerSuite) TestRunCapDropCannotMknod(c *check.C) {
|
| 683 | 683 |
} |
| 684 | 684 |
|
| 685 | 685 |
func (s *DockerSuite) TestRunCapDropCannotMknodLowerCase(c *check.C) {
|
| 686 |
- out, _, err := dockerCmdWithError(c, "run", "--cap-drop=mknod", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok") |
|
| 686 |
+ out, _, err := dockerCmdWithError("run", "--cap-drop=mknod", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
|
|
| 687 | 687 |
|
| 688 | 688 |
if err == nil {
|
| 689 | 689 |
c.Fatal(err, out) |
| ... | ... |
@@ -694,7 +694,7 @@ func (s *DockerSuite) TestRunCapDropCannotMknodLowerCase(c *check.C) {
|
| 694 | 694 |
} |
| 695 | 695 |
|
| 696 | 696 |
func (s *DockerSuite) TestRunCapDropALLCannotMknod(c *check.C) {
|
| 697 |
- out, _, err := dockerCmdWithError(c, "run", "--cap-drop=ALL", "--cap-add=SETGID", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok") |
|
| 697 |
+ out, _, err := dockerCmdWithError("run", "--cap-drop=ALL", "--cap-add=SETGID", "busybox", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok")
|
|
| 698 | 698 |
if err == nil {
|
| 699 | 699 |
c.Fatal(err, out) |
| 700 | 700 |
} |
| ... | ... |
@@ -712,7 +712,7 @@ func (s *DockerSuite) TestRunCapDropALLAddMknodCanMknod(c *check.C) {
|
| 712 | 712 |
} |
| 713 | 713 |
|
| 714 | 714 |
func (s *DockerSuite) TestRunCapAddInvalid(c *check.C) {
|
| 715 |
- out, _, err := dockerCmdWithError(c, "run", "--cap-add=CHPASS", "busybox", "ls") |
|
| 715 |
+ out, _, err := dockerCmdWithError("run", "--cap-add=CHPASS", "busybox", "ls")
|
|
| 716 | 716 |
if err == nil {
|
| 717 | 717 |
c.Fatal(err, out) |
| 718 | 718 |
} |
| ... | ... |
@@ -735,7 +735,7 @@ func (s *DockerSuite) TestRunCapAddALLCanDownInterface(c *check.C) {
|
| 735 | 735 |
} |
| 736 | 736 |
|
| 737 | 737 |
func (s *DockerSuite) TestRunCapAddALLDropNetAdminCanDownInterface(c *check.C) {
|
| 738 |
- out, _, err := dockerCmdWithError(c, "run", "--cap-add=ALL", "--cap-drop=NET_ADMIN", "busybox", "sh", "-c", "ip link set eth0 down && echo ok") |
|
| 738 |
+ out, _, err := dockerCmdWithError("run", "--cap-add=ALL", "--cap-drop=NET_ADMIN", "busybox", "sh", "-c", "ip link set eth0 down && echo ok")
|
|
| 739 | 739 |
if err == nil {
|
| 740 | 740 |
c.Fatal(err, out) |
| 741 | 741 |
} |
| ... | ... |
@@ -763,7 +763,7 @@ func (s *DockerSuite) TestRunPrivilegedCanMount(c *check.C) {
|
| 763 | 763 |
} |
| 764 | 764 |
|
| 765 | 765 |
func (s *DockerSuite) TestRunUnprivilegedCannotMount(c *check.C) {
|
| 766 |
- out, _, err := dockerCmdWithError(c, "run", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok") |
|
| 766 |
+ out, _, err := dockerCmdWithError("run", "busybox", "sh", "-c", "mount -t tmpfs none /tmp && echo ok")
|
|
| 767 | 767 |
|
| 768 | 768 |
if err == nil {
|
| 769 | 769 |
c.Fatal(err, out) |
| ... | ... |
@@ -774,19 +774,19 @@ func (s *DockerSuite) TestRunUnprivilegedCannotMount(c *check.C) {
|
| 774 | 774 |
} |
| 775 | 775 |
|
| 776 | 776 |
func (s *DockerSuite) TestRunSysNotWritableInNonPrivilegedContainers(c *check.C) {
|
| 777 |
- if _, code, err := dockerCmdWithError(c, "run", "busybox", "touch", "/sys/kernel/profiling"); err == nil || code == 0 {
|
|
| 777 |
+ if _, code, err := dockerCmdWithError("run", "busybox", "touch", "/sys/kernel/profiling"); err == nil || code == 0 {
|
|
| 778 | 778 |
c.Fatal("sys should not be writable in a non privileged container")
|
| 779 | 779 |
} |
| 780 | 780 |
} |
| 781 | 781 |
|
| 782 | 782 |
func (s *DockerSuite) TestRunSysWritableInPrivilegedContainers(c *check.C) {
|
| 783 |
- if _, code, err := dockerCmdWithError(c, "run", "--privileged", "busybox", "touch", "/sys/kernel/profiling"); err != nil || code != 0 {
|
|
| 783 |
+ if _, code, err := dockerCmdWithError("run", "--privileged", "busybox", "touch", "/sys/kernel/profiling"); err != nil || code != 0 {
|
|
| 784 | 784 |
c.Fatalf("sys should be writable in privileged container")
|
| 785 | 785 |
} |
| 786 | 786 |
} |
| 787 | 787 |
|
| 788 | 788 |
func (s *DockerSuite) TestRunProcNotWritableInNonPrivilegedContainers(c *check.C) {
|
| 789 |
- if _, code, err := dockerCmdWithError(c, "run", "busybox", "touch", "/proc/sysrq-trigger"); err == nil || code == 0 {
|
|
| 789 |
+ if _, code, err := dockerCmdWithError("run", "busybox", "touch", "/proc/sysrq-trigger"); err == nil || code == 0 {
|
|
| 790 | 790 |
c.Fatal("proc should not be writable in a non privileged container")
|
| 791 | 791 |
} |
| 792 | 792 |
} |
| ... | ... |
@@ -822,7 +822,7 @@ func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) {
|
| 822 | 822 |
} |
| 823 | 823 |
|
| 824 | 824 |
func (s *DockerSuite) TestRunWithBlkioInvalidWeight(c *check.C) {
|
| 825 |
- if _, _, err := dockerCmdWithError(c, "run", "--blkio-weight", "5", "busybox", "true"); err == nil {
|
|
| 825 |
+ if _, _, err := dockerCmdWithError("run", "--blkio-weight", "5", "busybox", "true"); err == nil {
|
|
| 826 | 826 |
c.Fatalf("run with invalid blkio-weight should failed")
|
| 827 | 827 |
} |
| 828 | 828 |
} |
| ... | ... |
@@ -890,7 +890,7 @@ func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) {
|
| 890 | 890 |
} |
| 891 | 891 |
|
| 892 | 892 |
func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) {
|
| 893 |
- out, _, err := dockerCmdWithError(c, "run", "-v", "/:/", "busybox", "ls", "/host") |
|
| 893 |
+ out, _, err := dockerCmdWithError("run", "-v", "/:/", "busybox", "ls", "/host")
|
|
| 894 | 894 |
if err == nil {
|
| 895 | 895 |
c.Fatal(out, err) |
| 896 | 896 |
} |
| ... | ... |
@@ -1382,7 +1382,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
|
| 1382 | 1382 |
|
| 1383 | 1383 |
// TestRunWorkdirExistsAndIsFile checks that if 'docker run -w' with existing file can be detected |
| 1384 | 1384 |
func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) {
|
| 1385 |
- out, exit, err := dockerCmdWithError(c, "run", "-w", "/bin/cat", "busybox") |
|
| 1385 |
+ out, exit, err := dockerCmdWithError("run", "-w", "/bin/cat", "busybox")
|
|
| 1386 | 1386 |
if !(err != nil && exit == 1 && strings.Contains(out, "Cannot mkdir: /bin/cat is not a directory")) {
|
| 1387 | 1387 |
c.Fatalf("Docker must complains about making dir, but we got out: %s, exit: %d, err: %s", out, exit, err)
|
| 1388 | 1388 |
} |
| ... | ... |
@@ -1509,7 +1509,7 @@ func (s *DockerSuite) TestRunWriteResolvFileAndNotCommit(c *check.C) {
|
| 1509 | 1509 |
|
| 1510 | 1510 |
func (s *DockerSuite) TestRunWithBadDevice(c *check.C) {
|
| 1511 | 1511 |
name := "baddevice" |
| 1512 |
- out, _, err := dockerCmdWithError(c, "run", "--name", name, "--device", "/etc", "busybox", "true") |
|
| 1512 |
+ out, _, err := dockerCmdWithError("run", "--name", name, "--device", "/etc", "busybox", "true")
|
|
| 1513 | 1513 |
|
| 1514 | 1514 |
if err == nil {
|
| 1515 | 1515 |
c.Fatal("Run should fail with bad device")
|
| ... | ... |
@@ -1553,7 +1553,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) {
|
| 1553 | 1553 |
readFile(path.Join(tmpDir, "holla"), c) // Will fail if the file doesn't exist |
| 1554 | 1554 |
|
| 1555 | 1555 |
// test mounting to an illegal destination directory |
| 1556 |
- _, _, err = dockerCmdWithError(c, "run", "-v", fmt.Sprintf("%s:.", tmpDir), "busybox", "ls", ".")
|
|
| 1556 |
+ _, _, err = dockerCmdWithError("run", "-v", fmt.Sprintf("%s:.", tmpDir), "busybox", "ls", ".")
|
|
| 1557 | 1557 |
if err == nil {
|
| 1558 | 1558 |
c.Fatal("Container bind mounted illegal directory")
|
| 1559 | 1559 |
} |
| ... | ... |
@@ -1577,7 +1577,7 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *check.C) {
|
| 1577 | 1577 |
defer os.RemoveAll(tmpDir) |
| 1578 | 1578 |
tmpCidFile := path.Join(tmpDir, "cid") |
| 1579 | 1579 |
|
| 1580 |
- out, _, err := dockerCmdWithError(c, "run", "--cidfile", tmpCidFile, "emptyfs") |
|
| 1580 |
+ out, _, err := dockerCmdWithError("run", "--cidfile", tmpCidFile, "emptyfs")
|
|
| 1581 | 1581 |
if err == nil {
|
| 1582 | 1582 |
c.Fatalf("Run without command must fail. out=%s", out)
|
| 1583 | 1583 |
} else if !strings.Contains(out, "No command specified") {
|
| ... | ... |
@@ -1641,7 +1641,7 @@ func (s *DockerSuite) TestRunInspectMacAddress(c *check.C) {
|
| 1641 | 1641 |
|
| 1642 | 1642 |
// test docker run use a invalid mac address |
| 1643 | 1643 |
func (s *DockerSuite) TestRunWithInvalidMacAddress(c *check.C) {
|
| 1644 |
- out, _, err := dockerCmdWithError(c, "run", "--mac-address", "92:d0:c6:0a:29", "busybox") |
|
| 1644 |
+ out, _, err := dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29", "busybox")
|
|
| 1645 | 1645 |
//use a invalid mac address should with a error out |
| 1646 | 1646 |
if err == nil || !strings.Contains(out, "is not a valid mac address") {
|
| 1647 | 1647 |
c.Fatalf("run with an invalid --mac-address should with error out")
|
| ... | ... |
@@ -1675,7 +1675,7 @@ func (s *DockerSuite) TestRunPortInUse(c *check.C) {
|
| 1675 | 1675 |
port := "1234" |
| 1676 | 1676 |
dockerCmd(c, "run", "-d", "-p", port+":80", "busybox", "top") |
| 1677 | 1677 |
|
| 1678 |
- out, _, err := dockerCmdWithError(c, "run", "-d", "-p", port+":80", "busybox", "top") |
|
| 1678 |
+ out, _, err := dockerCmdWithError("run", "-d", "-p", port+":80", "busybox", "top")
|
|
| 1679 | 1679 |
if err == nil {
|
| 1680 | 1680 |
c.Fatalf("Binding on used port must fail")
|
| 1681 | 1681 |
} |
| ... | ... |
@@ -1800,12 +1800,12 @@ func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) {
|
| 1800 | 1800 |
|
| 1801 | 1801 |
dockerCmd(c, "run", "--name", "test", "-v", "/foo", "busybox") |
| 1802 | 1802 |
|
| 1803 |
- if out, _, err := dockerCmdWithError(c, "run", "--volumes-from", "test", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
|
|
| 1803 |
+ if out, _, err := dockerCmdWithError("run", "--volumes-from", "test", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
|
|
| 1804 | 1804 |
c.Fatalf("Data was copied on volumes-from but shouldn't be:\n%q", out)
|
| 1805 | 1805 |
} |
| 1806 | 1806 |
|
| 1807 | 1807 |
tmpDir := randomUnixTmpDirPath("docker_test_bind_mount_copy_data")
|
| 1808 |
- if out, _, err := dockerCmdWithError(c, "run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
|
|
| 1808 |
+ if out, _, err := dockerCmdWithError("run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") {
|
|
| 1809 | 1809 |
c.Fatalf("Data was copied on bind-mount but shouldn't be:\n%q", out)
|
| 1810 | 1810 |
} |
| 1811 | 1811 |
} |
| ... | ... |
@@ -1902,7 +1902,7 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *check.C) {
|
| 1902 | 1902 |
|
| 1903 | 1903 |
// test docker run expose a invalid port |
| 1904 | 1904 |
func (s *DockerSuite) TestRunExposePort(c *check.C) {
|
| 1905 |
- out, _, err := dockerCmdWithError(c, "run", "--expose", "80000", "busybox") |
|
| 1905 |
+ out, _, err := dockerCmdWithError("run", "--expose", "80000", "busybox")
|
|
| 1906 | 1906 |
//expose a invalid port should with a error out |
| 1907 | 1907 |
if err == nil || !strings.Contains(out, "Invalid range format for --expose") {
|
| 1908 | 1908 |
c.Fatalf("run --expose a invalid port should with error out")
|
| ... | ... |
@@ -1914,7 +1914,7 @@ func (s *DockerSuite) TestRunUnknownCommand(c *check.C) {
|
| 1914 | 1914 |
out, _, _ := dockerCmdWithStdoutStderr(c, "create", "busybox", "/bin/nada") |
| 1915 | 1915 |
|
| 1916 | 1916 |
cID := strings.TrimSpace(out) |
| 1917 |
- _, _, err := dockerCmdWithError(c, "start", cID) |
|
| 1917 |
+ _, _, err := dockerCmdWithError("start", cID)
|
|
| 1918 | 1918 |
c.Assert(err, check.NotNil) |
| 1919 | 1919 |
|
| 1920 | 1920 |
rc, err := inspectField(cID, "State.ExitCode") |
| ... | ... |
@@ -1972,7 +1972,7 @@ func (s *DockerSuite) TestRunModeIpcContainer(c *check.C) {
|
| 1972 | 1972 |
} |
| 1973 | 1973 |
|
| 1974 | 1974 |
func (s *DockerSuite) TestRunModeIpcContainerNotExists(c *check.C) {
|
| 1975 |
- out, _, err := dockerCmdWithError(c, "run", "-d", "--ipc", "container:abcd1234", "busybox", "top") |
|
| 1975 |
+ out, _, err := dockerCmdWithError("run", "-d", "--ipc", "container:abcd1234", "busybox", "top")
|
|
| 1976 | 1976 |
if !strings.Contains(out, "abcd1234") || err == nil {
|
| 1977 | 1977 |
c.Fatalf("run IPC from a non exists container should with correct error out")
|
| 1978 | 1978 |
} |
| ... | ... |
@@ -1984,7 +1984,7 @@ func (s *DockerSuite) TestRunModeIpcContainerNotRunning(c *check.C) {
|
| 1984 | 1984 |
out, _ := dockerCmd(c, "create", "busybox") |
| 1985 | 1985 |
|
| 1986 | 1986 |
id := strings.TrimSpace(out) |
| 1987 |
- out, _, err := dockerCmdWithError(c, "run", fmt.Sprintf("--ipc=container:%s", id), "busybox")
|
|
| 1987 |
+ out, _, err := dockerCmdWithError("run", fmt.Sprintf("--ipc=container:%s", id), "busybox")
|
|
| 1988 | 1988 |
if err == nil {
|
| 1989 | 1989 |
c.Fatalf("Run container with ipc mode container should fail with non running container: %s\n%s", out, err)
|
| 1990 | 1990 |
} |
| ... | ... |
@@ -2056,18 +2056,18 @@ func (s *DockerSuite) TestRunModeUTSHost(c *check.C) {
|
| 2056 | 2056 |
} |
| 2057 | 2057 |
|
| 2058 | 2058 |
func (s *DockerSuite) TestRunTLSverify(c *check.C) {
|
| 2059 |
- if out, code, err := dockerCmdWithError(c, "ps"); err != nil || code != 0 {
|
|
| 2059 |
+ if out, code, err := dockerCmdWithError("ps"); err != nil || code != 0 {
|
|
| 2060 | 2060 |
c.Fatalf("Should have worked: %v:\n%v", err, out)
|
| 2061 | 2061 |
} |
| 2062 | 2062 |
|
| 2063 | 2063 |
// Regardless of whether we specify true or false we need to |
| 2064 | 2064 |
// test to make sure tls is turned on if --tlsverify is specified at all |
| 2065 |
- out, code, err := dockerCmdWithError(c, "--tlsverify=false", "ps") |
|
| 2065 |
+ out, code, err := dockerCmdWithError("--tlsverify=false", "ps")
|
|
| 2066 | 2066 |
if err == nil || code == 0 || !strings.Contains(out, "trying to connect") {
|
| 2067 | 2067 |
c.Fatalf("Should have failed: \net:%v\nout:%v\nerr:%v", code, out, err)
|
| 2068 | 2068 |
} |
| 2069 | 2069 |
|
| 2070 |
- out, code, err = dockerCmdWithError(c, "--tlsverify=true", "ps") |
|
| 2070 |
+ out, code, err = dockerCmdWithError("--tlsverify=true", "ps")
|
|
| 2071 | 2071 |
if err == nil || code == 0 || !strings.Contains(out, "cert") {
|
| 2072 | 2072 |
c.Fatalf("Should have failed: \net:%v\nout:%v\nerr:%v", code, out, err)
|
| 2073 | 2073 |
} |
| ... | ... |
@@ -2264,7 +2264,7 @@ func (s *DockerSuite) TestPermissionsPtsReadonlyRootfs(c *check.C) {
|
| 2264 | 2264 |
func testReadOnlyFile(filename string, c *check.C) {
|
| 2265 | 2265 |
testRequires(c, NativeExecDriver) |
| 2266 | 2266 |
|
| 2267 |
- out, _, err := dockerCmdWithError(c, "run", "--read-only", "--rm", "busybox", "touch", filename) |
|
| 2267 |
+ out, _, err := dockerCmdWithError("run", "--read-only", "--rm", "busybox", "touch", filename)
|
|
| 2268 | 2268 |
if err == nil {
|
| 2269 | 2269 |
c.Fatal("expected container to error on run with read only error")
|
| 2270 | 2270 |
} |
| ... | ... |
@@ -2273,7 +2273,7 @@ func testReadOnlyFile(filename string, c *check.C) {
|
| 2273 | 2273 |
c.Fatalf("expected output from failure to contain %s but contains %s", expected, out)
|
| 2274 | 2274 |
} |
| 2275 | 2275 |
|
| 2276 |
- out, _, err = dockerCmdWithError(c, "run", "--read-only", "--privileged", "--rm", "busybox", "touch", filename) |
|
| 2276 |
+ out, _, err = dockerCmdWithError("run", "--read-only", "--privileged", "--rm", "busybox", "touch", filename)
|
|
| 2277 | 2277 |
if err == nil {
|
| 2278 | 2278 |
c.Fatal("expected container to error on run with read only error")
|
| 2279 | 2279 |
} |
| ... | ... |
@@ -2326,7 +2326,7 @@ func (s *DockerSuite) TestRunVolumesFromRestartAfterRemoved(c *check.C) {
|
| 2326 | 2326 |
// run container with --rm should remove container if exit code != 0 |
| 2327 | 2327 |
func (s *DockerSuite) TestRunContainerWithRmFlagExitCodeNotEqualToZero(c *check.C) {
|
| 2328 | 2328 |
name := "flowers" |
| 2329 |
- out, _, err := dockerCmdWithError(c, "run", "--name", name, "--rm", "busybox", "ls", "/notexists") |
|
| 2329 |
+ out, _, err := dockerCmdWithError("run", "--name", name, "--rm", "busybox", "ls", "/notexists")
|
|
| 2330 | 2330 |
if err == nil {
|
| 2331 | 2331 |
c.Fatal("Expected docker run to fail", out, err)
|
| 2332 | 2332 |
} |
| ... | ... |
@@ -2343,7 +2343,7 @@ func (s *DockerSuite) TestRunContainerWithRmFlagExitCodeNotEqualToZero(c *check. |
| 2343 | 2343 |
|
| 2344 | 2344 |
func (s *DockerSuite) TestRunContainerWithRmFlagCannotStartContainer(c *check.C) {
|
| 2345 | 2345 |
name := "sparkles" |
| 2346 |
- out, _, err := dockerCmdWithError(c, "run", "--name", name, "--rm", "busybox", "commandNotFound") |
|
| 2346 |
+ out, _, err := dockerCmdWithError("run", "--name", name, "--rm", "busybox", "commandNotFound")
|
|
| 2347 | 2347 |
if err == nil {
|
| 2348 | 2348 |
c.Fatal("Expected docker run to fail", out, err)
|
| 2349 | 2349 |
} |
| ... | ... |
@@ -2365,7 +2365,7 @@ func (s *DockerSuite) TestRunPidHostWithChildIsKillable(c *check.C) {
|
| 2365 | 2365 |
time.Sleep(1 * time.Second) |
| 2366 | 2366 |
errchan := make(chan error) |
| 2367 | 2367 |
go func() {
|
| 2368 |
- if out, _, err := dockerCmdWithError(c, "kill", name); err != nil {
|
|
| 2368 |
+ if out, _, err := dockerCmdWithError("kill", name); err != nil {
|
|
| 2369 | 2369 |
errchan <- fmt.Errorf("%v:\n%s", err, out)
|
| 2370 | 2370 |
} |
| 2371 | 2371 |
close(errchan) |
| ... | ... |
@@ -2381,14 +2381,14 @@ func (s *DockerSuite) TestRunPidHostWithChildIsKillable(c *check.C) {
|
| 2381 | 2381 |
func (s *DockerSuite) TestRunWithTooSmallMemoryLimit(c *check.C) {
|
| 2382 | 2382 |
// this memory limit is 1 byte less than the min, which is 4MB |
| 2383 | 2383 |
// https://github.com/docker/docker/blob/v1.5.0/daemon/create.go#L22 |
| 2384 |
- out, _, err := dockerCmdWithError(c, "run", "-m", "4194303", "busybox") |
|
| 2384 |
+ out, _, err := dockerCmdWithError("run", "-m", "4194303", "busybox")
|
|
| 2385 | 2385 |
if err == nil || !strings.Contains(out, "Minimum memory limit allowed is 4MB") {
|
| 2386 | 2386 |
c.Fatalf("expected run to fail when using too low a memory limit: %q", out)
|
| 2387 | 2387 |
} |
| 2388 | 2388 |
} |
| 2389 | 2389 |
|
| 2390 | 2390 |
func (s *DockerSuite) TestRunWriteToProcAsound(c *check.C) {
|
| 2391 |
- _, code, err := dockerCmdWithError(c, "run", "busybox", "sh", "-c", "echo 111 >> /proc/asound/version") |
|
| 2391 |
+ _, code, err := dockerCmdWithError("run", "busybox", "sh", "-c", "echo 111 >> /proc/asound/version")
|
|
| 2392 | 2392 |
if err == nil || code == 0 {
|
| 2393 | 2393 |
c.Fatal("standard container should not be able to write to /proc/asound")
|
| 2394 | 2394 |
} |
| ... | ... |
@@ -2396,7 +2396,7 @@ func (s *DockerSuite) TestRunWriteToProcAsound(c *check.C) {
|
| 2396 | 2396 |
|
| 2397 | 2397 |
func (s *DockerSuite) TestRunReadProcTimer(c *check.C) {
|
| 2398 | 2398 |
testRequires(c, NativeExecDriver) |
| 2399 |
- out, code, err := dockerCmdWithError(c, "run", "busybox", "cat", "/proc/timer_stats") |
|
| 2399 |
+ out, code, err := dockerCmdWithError("run", "busybox", "cat", "/proc/timer_stats")
|
|
| 2400 | 2400 |
if err != nil || code != 0 {
|
| 2401 | 2401 |
c.Fatal(err) |
| 2402 | 2402 |
} |
| ... | ... |
@@ -2413,7 +2413,7 @@ func (s *DockerSuite) TestRunReadProcLatency(c *check.C) {
|
| 2413 | 2413 |
c.Skip("kernel doesnt have latency_stats configured")
|
| 2414 | 2414 |
return |
| 2415 | 2415 |
} |
| 2416 |
- out, code, err := dockerCmdWithError(c, "run", "busybox", "cat", "/proc/latency_stats") |
|
| 2416 |
+ out, code, err := dockerCmdWithError("run", "busybox", "cat", "/proc/latency_stats")
|
|
| 2417 | 2417 |
if err != nil || code != 0 {
|
| 2418 | 2418 |
c.Fatal(err) |
| 2419 | 2419 |
} |
| ... | ... |
@@ -2424,7 +2424,7 @@ func (s *DockerSuite) TestRunReadProcLatency(c *check.C) {
|
| 2424 | 2424 |
|
| 2425 | 2425 |
func (s *DockerSuite) TestMountIntoProc(c *check.C) {
|
| 2426 | 2426 |
testRequires(c, NativeExecDriver) |
| 2427 |
- _, code, err := dockerCmdWithError(c, "run", "-v", "/proc//sys", "busybox", "true") |
|
| 2427 |
+ _, code, err := dockerCmdWithError("run", "-v", "/proc//sys", "busybox", "true")
|
|
| 2428 | 2428 |
if err == nil || code == 0 {
|
| 2429 | 2429 |
c.Fatal("container should not be able to mount into /proc")
|
| 2430 | 2430 |
} |
| ... | ... |
@@ -2439,18 +2439,18 @@ func (s *DockerSuite) TestRunUnshareProc(c *check.C) {
|
| 2439 | 2439 |
testRequires(c, Apparmor, NativeExecDriver) |
| 2440 | 2440 |
|
| 2441 | 2441 |
name := "acidburn" |
| 2442 |
- 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") {
|
|
| 2442 |
+ 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") {
|
|
| 2443 | 2443 |
c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
|
| 2444 | 2444 |
} |
| 2445 | 2445 |
|
| 2446 | 2446 |
name = "cereal" |
| 2447 |
- 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") {
|
|
| 2447 |
+ 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") {
|
|
| 2448 | 2448 |
c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
|
| 2449 | 2449 |
} |
| 2450 | 2450 |
|
| 2451 | 2451 |
/* Ensure still fails if running privileged with the default policy */ |
| 2452 | 2452 |
name = "crashoverride" |
| 2453 |
- 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") {
|
|
| 2453 |
+ 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") {
|
|
| 2454 | 2454 |
c.Fatalf("unshare should have failed with permission denied, got: %s, %v", out, err)
|
| 2455 | 2455 |
} |
| 2456 | 2456 |
} |
| ... | ... |
@@ -102,7 +102,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupParent(c *check.C) {
|
| 102 | 102 |
cgroupParent := "test" |
| 103 | 103 |
name := "cgroup-test" |
| 104 | 104 |
|
| 105 |
- out, _, err := dockerCmdWithError(c, "run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup") |
|
| 105 |
+ out, _, err := dockerCmdWithError("run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
|
|
| 106 | 106 |
if err != nil {
|
| 107 | 107 |
c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err)
|
| 108 | 108 |
} |
| ... | ... |
@@ -130,7 +130,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupParentAbsPath(c *check.C) {
|
| 130 | 130 |
|
| 131 | 131 |
cgroupParent := "/cgroup-parent/test" |
| 132 | 132 |
name := "cgroup-test" |
| 133 |
- out, _, err := dockerCmdWithError(c, "run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup") |
|
| 133 |
+ out, _, err := dockerCmdWithError("run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
|
|
| 134 | 134 |
if err != nil {
|
| 135 | 135 |
c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err)
|
| 136 | 136 |
} |
| ... | ... |
@@ -157,7 +157,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupMountRO(c *check.C) {
|
| 157 | 157 |
testRequires(c, NativeExecDriver) |
| 158 | 158 |
|
| 159 | 159 |
filename := "/sys/fs/cgroup/devices/test123" |
| 160 |
- out, _, err := dockerCmdWithError(c, "run", "busybox", "touch", filename) |
|
| 160 |
+ out, _, err := dockerCmdWithError("run", "busybox", "touch", filename)
|
|
| 161 | 161 |
if err == nil {
|
| 162 | 162 |
c.Fatal("expected cgroup mount point to be read-only, touch file should fail")
|
| 163 | 163 |
} |
| ... | ... |
@@ -252,7 +252,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *check.C) {
|
| 252 | 252 |
func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) {
|
| 253 | 253 |
testRequires(c, cpuCfsQuota) |
| 254 | 254 |
|
| 255 |
- out, _, err := dockerCmdWithError(c, "run", "--cpu-quota", "8000", "--name", "test", "busybox", "echo", "test") |
|
| 255 |
+ out, _, err := dockerCmdWithError("run", "--cpu-quota", "8000", "--name", "test", "busybox", "echo", "test")
|
|
| 256 | 256 |
if err != nil {
|
| 257 | 257 |
c.Fatalf("failed to run container: %v, output: %q", err, out)
|
| 258 | 258 |
} |
| ... | ... |
@@ -272,7 +272,7 @@ func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) {
|
| 272 | 272 |
func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
|
| 273 | 273 |
testRequires(c, cpuCfsPeriod) |
| 274 | 274 |
|
| 275 |
- if _, _, err := dockerCmdWithError(c, "run", "--cpu-period", "50000", "--name", "test", "busybox", "true"); err != nil {
|
|
| 275 |
+ if _, _, err := dockerCmdWithError("run", "--cpu-period", "50000", "--name", "test", "busybox", "true"); err != nil {
|
|
| 276 | 276 |
c.Fatalf("failed to run container: %v", err)
|
| 277 | 277 |
} |
| 278 | 278 |
|
| ... | ... |
@@ -288,7 +288,7 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
| 288 | 288 |
errChan := make(chan error) |
| 289 | 289 |
go func() {
|
| 290 | 290 |
defer close(errChan) |
| 291 |
- out, exitCode, _ := dockerCmdWithError(c, "run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done") |
|
| 291 |
+ out, exitCode, _ := dockerCmdWithError("run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
|
|
| 292 | 292 |
if expected := 137; exitCode != expected {
|
| 293 | 293 |
errChan <- fmt.Errorf("wrong exit code for OOM container: expected %d, got %d (output: %q)", expected, exitCode, out)
|
| 294 | 294 |
} |
| ... | ... |
@@ -303,29 +303,29 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
| 303 | 303 |
} |
| 304 | 304 |
|
| 305 | 305 |
func (s *DockerSuite) TestContainerNetworkModeToSelf(c *check.C) {
|
| 306 |
- out, _, err := dockerCmdWithError(c, "run", "--name=me", "--net=container:me", "busybox", "true") |
|
| 306 |
+ out, _, err := dockerCmdWithError("run", "--name=me", "--net=container:me", "busybox", "true")
|
|
| 307 | 307 |
if err == nil || !strings.Contains(out, "cannot join own network") {
|
| 308 | 308 |
c.Fatalf("using container net mode to self should result in an error")
|
| 309 | 309 |
} |
| 310 | 310 |
} |
| 311 | 311 |
|
| 312 | 312 |
func (s *DockerSuite) TestRunContainerNetModeWithDnsMacHosts(c *check.C) {
|
| 313 |
- out, _, err := dockerCmdWithError(c, "run", "-d", "--name", "parent", "busybox", "top") |
|
| 313 |
+ out, _, err := dockerCmdWithError("run", "-d", "--name", "parent", "busybox", "top")
|
|
| 314 | 314 |
if err != nil {
|
| 315 | 315 |
c.Fatalf("failed to run container: %v, output: %q", err, out)
|
| 316 | 316 |
} |
| 317 | 317 |
|
| 318 |
- out, _, err = dockerCmdWithError(c, "run", "--dns", "1.2.3.4", "--net=container:parent", "busybox") |
|
| 318 |
+ out, _, err = dockerCmdWithError("run", "--dns", "1.2.3.4", "--net=container:parent", "busybox")
|
|
| 319 | 319 |
if err == nil || !strings.Contains(out, "Conflicting options: --dns and the network mode") {
|
| 320 | 320 |
c.Fatalf("run --net=container with --dns should error out")
|
| 321 | 321 |
} |
| 322 | 322 |
|
| 323 |
- out, _, err = dockerCmdWithError(c, "run", "--mac-address", "92:d0:c6:0a:29:33", "--net=container:parent", "busybox") |
|
| 323 |
+ out, _, err = dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29:33", "--net=container:parent", "busybox")
|
|
| 324 | 324 |
if err == nil || !strings.Contains(out, "--mac-address and the network mode") {
|
| 325 | 325 |
c.Fatalf("run --net=container with --mac-address should error out")
|
| 326 | 326 |
} |
| 327 | 327 |
|
| 328 |
- out, _, err = dockerCmdWithError(c, "run", "--add-host", "test:192.168.2.109", "--net=container:parent", "busybox") |
|
| 328 |
+ out, _, err = dockerCmdWithError("run", "--add-host", "test:192.168.2.109", "--net=container:parent", "busybox")
|
|
| 329 | 329 |
if err == nil || !strings.Contains(out, "--add-host and the network mode") {
|
| 330 | 330 |
c.Fatalf("run --net=container with --add-host should error out")
|
| 331 | 331 |
} |
| ... | ... |
@@ -334,17 +334,17 @@ func (s *DockerSuite) TestRunContainerNetModeWithDnsMacHosts(c *check.C) {
|
| 334 | 334 |
func (s *DockerSuite) TestRunContainerNetModeWithExposePort(c *check.C) {
|
| 335 | 335 |
dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top") |
| 336 | 336 |
|
| 337 |
- out, _, err := dockerCmdWithError(c, "run", "-p", "5000:5000", "--net=container:parent", "busybox") |
|
| 337 |
+ out, _, err := dockerCmdWithError("run", "-p", "5000:5000", "--net=container:parent", "busybox")
|
|
| 338 | 338 |
if err == nil || !strings.Contains(out, "Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)") {
|
| 339 | 339 |
c.Fatalf("run --net=container with -p should error out")
|
| 340 | 340 |
} |
| 341 | 341 |
|
| 342 |
- out, _, err = dockerCmdWithError(c, "run", "-P", "--net=container:parent", "busybox") |
|
| 342 |
+ out, _, err = dockerCmdWithError("run", "-P", "--net=container:parent", "busybox")
|
|
| 343 | 343 |
if err == nil || !strings.Contains(out, "Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)") {
|
| 344 | 344 |
c.Fatalf("run --net=container with -P should error out")
|
| 345 | 345 |
} |
| 346 | 346 |
|
| 347 |
- out, _, err = dockerCmdWithError(c, "run", "--expose", "5000", "--net=container:parent", "busybox") |
|
| 347 |
+ out, _, err = dockerCmdWithError("run", "--expose", "5000", "--net=container:parent", "busybox")
|
|
| 348 | 348 |
if err == nil || !strings.Contains(out, "Conflicting options: --expose and the network mode (--expose)") {
|
| 349 | 349 |
c.Fatalf("run --net=container with --expose should error out")
|
| 350 | 350 |
} |
| ... | ... |
@@ -399,7 +399,7 @@ func (s *DockerSuite) TestRunModeNetContainerHostname(c *check.C) {
|
| 399 | 399 |
} |
| 400 | 400 |
|
| 401 | 401 |
func (s *DockerSuite) TestRunNetworkNotInitializedNoneMode(c *check.C) {
|
| 402 |
- out, _, err := dockerCmdWithError(c, "run", "-d", "--net=none", "busybox", "top") |
|
| 402 |
+ out, _, err := dockerCmdWithError("run", "-d", "--net=none", "busybox", "top")
|
|
| 403 | 403 |
id := strings.TrimSpace(out) |
| 404 | 404 |
res, err := inspectField(id, "NetworkSettings.IPAddress") |
| 405 | 405 |
c.Assert(err, check.IsNil) |
| ... | ... |
@@ -39,7 +39,7 @@ func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) {
|
| 39 | 39 |
c.Fatalf("expected error, but succeeded with no error and output: %v", out)
|
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 |
- after, _, err := dockerCmdWithError(c, "inspect", repoName) |
|
| 42 |
+ after, _, err := dockerCmdWithError("inspect", repoName)
|
|
| 43 | 43 |
if err == nil {
|
| 44 | 44 |
c.Fatalf("the repo should not exist: %v", after)
|
| 45 | 45 |
} |
| ... | ... |
@@ -72,7 +72,7 @@ func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) {
|
| 72 | 72 |
c.Fatalf("expected error, but succeeded with no error and output: %v", out)
|
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 |
- after, _, err := dockerCmdWithError(c, "inspect", repoName) |
|
| 75 |
+ after, _, err := dockerCmdWithError("inspect", repoName)
|
|
| 76 | 76 |
if err == nil {
|
| 77 | 77 |
c.Fatalf("the repo should not exist: %v", after)
|
| 78 | 78 |
} |
| ... | ... |
@@ -21,7 +21,7 @@ func (s *DockerSuite) TestSearchOnCentralRegistry(c *check.C) {
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
|
| 24 |
- out, exitCode, err := dockerCmdWithError(c, "search", "--stars=a", "busybox") |
|
| 24 |
+ out, exitCode, err := dockerCmdWithError("search", "--stars=a", "busybox")
|
|
| 25 | 25 |
if err == nil || exitCode == 0 {
|
| 26 | 26 |
c.Fatalf("Should not get right information: %s, %v", out, err)
|
| 27 | 27 |
} |
| ... | ... |
@@ -30,7 +30,7 @@ func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
|
| 30 | 30 |
c.Fatal("couldn't find the invalid value warning")
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
- out, exitCode, err = dockerCmdWithError(c, "search", "-s=-1", "busybox") |
|
| 33 |
+ out, exitCode, err = dockerCmdWithError("search", "-s=-1", "busybox")
|
|
| 34 | 34 |
if err == nil || exitCode == 0 {
|
| 35 | 35 |
c.Fatalf("Should not get right information: %s, %v", out, err)
|
| 36 | 36 |
} |
| ... | ... |
@@ -14,7 +14,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
|
| 14 | 14 |
dockerCmd(c, "wait", "test") |
| 15 | 15 |
|
| 16 | 16 |
// Expect this to fail because the above container is stopped, this is what we want |
| 17 |
- if _, _, err := dockerCmdWithError(c, "run", "-d", "--name", "test2", "--link", "test:test", "busybox"); err == nil {
|
|
| 17 |
+ if _, _, err := dockerCmdWithError("run", "-d", "--name", "test2", "--link", "test:test", "busybox"); err == nil {
|
|
| 18 | 18 |
c.Fatal("Expected error but got none")
|
| 19 | 19 |
} |
| 20 | 20 |
|
| ... | ... |
@@ -22,7 +22,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
|
| 22 | 22 |
go func() {
|
| 23 | 23 |
// Attempt to start attached to the container that won't start |
| 24 | 24 |
// This should return an error immediately since the container can't be started |
| 25 |
- if _, _, err := dockerCmdWithError(c, "start", "-a", "test2"); err == nil {
|
|
| 25 |
+ if _, _, err := dockerCmdWithError("start", "-a", "test2"); err == nil {
|
|
| 26 | 26 |
ch <- fmt.Errorf("Expected error but got none")
|
| 27 | 27 |
} |
| 28 | 28 |
close(ch) |
| ... | ... |
@@ -44,7 +44,7 @@ func (s *DockerSuite) TestStartAttachCorrectExitCode(c *check.C) {
|
| 44 | 44 |
// make sure the container has exited before trying the "start -a" |
| 45 | 45 |
dockerCmd(c, "wait", out) |
| 46 | 46 |
|
| 47 |
- startOut, exitCode, err := dockerCmdWithError(c, "start", "-a", out) |
|
| 47 |
+ startOut, exitCode, err := dockerCmdWithError("start", "-a", out)
|
|
| 48 | 48 |
if err != nil && !strings.Contains("exit status 1", fmt.Sprintf("%s", err)) {
|
| 49 | 49 |
c.Fatalf("start command failed unexpectedly with error: %v, output: %q", err, startOut)
|
| 50 | 50 |
} |
| ... | ... |
@@ -78,7 +78,7 @@ func (s *DockerSuite) TestStartRecordError(c *check.C) {
|
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 | 80 |
// Expect this to fail and records error because of ports conflict |
| 81 |
- out, _, err := dockerCmdWithError(c, "run", "-d", "--name", "test2", "-p", "9999:9999", "busybox", "top") |
|
| 81 |
+ out, _, err := dockerCmdWithError("run", "-d", "--name", "test2", "-p", "9999:9999", "busybox", "top")
|
|
| 82 | 82 |
if err == nil {
|
| 83 | 83 |
c.Fatalf("Expected error but got none, output %q", out)
|
| 84 | 84 |
} |
| ... | ... |
@@ -107,7 +107,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *check.C) {
|
| 107 | 107 |
|
| 108 | 108 |
dockerCmd(c, "pause", "testing") |
| 109 | 109 |
|
| 110 |
- if out, _, err := dockerCmdWithError(c, "start", "testing"); err == nil || !strings.Contains(out, "Cannot start a paused container, try unpause instead.") {
|
|
| 110 |
+ if out, _, err := dockerCmdWithError("start", "testing"); err == nil || !strings.Contains(out, "Cannot start a paused container, try unpause instead.") {
|
|
| 111 | 111 |
c.Fatalf("an error should have been shown that you cannot start paused container: %s\n%v", out, err)
|
| 112 | 112 |
} |
| 113 | 113 |
} |
| ... | ... |
@@ -131,7 +131,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
|
| 131 | 131 |
|
| 132 | 132 |
// start all the three containers, container `child_first` start first which should be failed |
| 133 | 133 |
// container 'parent' start second and then start container 'child_second' |
| 134 |
- out, _, err = dockerCmdWithError(c, "start", "child_first", "parent", "child_second") |
|
| 134 |
+ out, _, err = dockerCmdWithError("start", "child_first", "parent", "child_second")
|
|
| 135 | 135 |
if !strings.Contains(out, "Cannot start container child_first") || err == nil {
|
| 136 | 136 |
c.Fatal("Expected error but got none")
|
| 137 | 137 |
} |
| ... | ... |
@@ -159,7 +159,7 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *check.C) {
|
| 159 | 159 |
|
| 160 | 160 |
// test start and attach multiple containers at once, expected error |
| 161 | 161 |
for _, option := range []string{"-a", "-i", "-ai"} {
|
| 162 |
- out, _, err := dockerCmdWithError(c, "start", option, "test1", "test2", "test3") |
|
| 162 |
+ out, _, err := dockerCmdWithError("start", option, "test1", "test2", "test3")
|
|
| 163 | 163 |
if !strings.Contains(out, "You cannot start and attach multiple containers at once.") || err == nil {
|
| 164 | 164 |
c.Fatal("Expected error but got none")
|
| 165 | 165 |
} |
| ... | ... |
@@ -29,7 +29,7 @@ func (s *DockerSuite) TestTagInvalidUnprefixedRepo(c *check.C) {
|
| 29 | 29 |
invalidRepos := []string{"fo$z$", "Foo@3cc", "Foo$3", "Foo*3", "Fo^3", "Foo!3", "F)xcz(", "fo%asd"}
|
| 30 | 30 |
|
| 31 | 31 |
for _, repo := range invalidRepos {
|
| 32 |
- _, _, err := dockerCmdWithError(c, "tag", "busybox", repo) |
|
| 32 |
+ _, _, err := dockerCmdWithError("tag", "busybox", repo)
|
|
| 33 | 33 |
if err == nil {
|
| 34 | 34 |
c.Fatalf("tag busybox %v should have failed", repo)
|
| 35 | 35 |
} |
| ... | ... |
@@ -43,7 +43,7 @@ func (s *DockerSuite) TestTagInvalidPrefixedRepo(c *check.C) {
|
| 43 | 43 |
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}
|
| 44 | 44 |
|
| 45 | 45 |
for _, repotag := range invalidTags {
|
| 46 |
- _, _, err := dockerCmdWithError(c, "tag", "busybox", repotag) |
|
| 46 |
+ _, _, err := dockerCmdWithError("tag", "busybox", repotag)
|
|
| 47 | 47 |
if err == nil {
|
| 48 | 48 |
c.Fatalf("tag busybox %v should have failed", repotag)
|
| 49 | 49 |
} |
| ... | ... |
@@ -59,7 +59,7 @@ func (s *DockerSuite) TestTagValidPrefixedRepo(c *check.C) {
|
| 59 | 59 |
validRepos := []string{"fooo/bar", "fooaa/test", "foooo:t"}
|
| 60 | 60 |
|
| 61 | 61 |
for _, repo := range validRepos {
|
| 62 |
- _, _, err := dockerCmdWithError(c, "tag", "busybox:latest", repo) |
|
| 62 |
+ _, _, err := dockerCmdWithError("tag", "busybox:latest", repo)
|
|
| 63 | 63 |
if err != nil {
|
| 64 | 64 |
c.Errorf("tag busybox %v should have worked: %s", repo, err)
|
| 65 | 65 |
continue |
| ... | ... |
@@ -75,7 +75,7 @@ func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
dockerCmd(c, "tag", "busybox:latest", "busybox:test") |
| 78 |
- out, _, err := dockerCmdWithError(c, "tag", "busybox:latest", "busybox:test") |
|
| 78 |
+ out, _, err := dockerCmdWithError("tag", "busybox:latest", "busybox:test")
|
|
| 79 | 79 |
if err == nil || !strings.Contains(out, "Conflict: Tag test is already set to image") {
|
| 80 | 80 |
c.Fatal("tag busybox busybox:test should have failed,because busybox:test is existed")
|
| 81 | 81 |
} |
| ... | ... |
@@ -96,17 +96,17 @@ func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) {
|
| 96 | 96 |
c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
|
| 97 | 97 |
} |
| 98 | 98 |
// test repository name begin with '-' |
| 99 |
- out, _, err := dockerCmdWithError(c, "tag", "busybox:latest", "-busybox:test") |
|
| 99 |
+ out, _, err := dockerCmdWithError("tag", "busybox:latest", "-busybox:test")
|
|
| 100 | 100 |
if err == nil || !strings.Contains(out, "repository name component must match") {
|
| 101 | 101 |
c.Fatal("tag a name begin with '-' should failed")
|
| 102 | 102 |
} |
| 103 | 103 |
// test namespace name begin with '-' |
| 104 |
- out, _, err = dockerCmdWithError(c, "tag", "busybox:latest", "-test/busybox:test") |
|
| 104 |
+ out, _, err = dockerCmdWithError("tag", "busybox:latest", "-test/busybox:test")
|
|
| 105 | 105 |
if err == nil || !strings.Contains(out, "repository name component must match") {
|
| 106 | 106 |
c.Fatal("tag a name begin with '-' should failed")
|
| 107 | 107 |
} |
| 108 | 108 |
// test index name begin wiht '-' |
| 109 |
- out, _, err = dockerCmdWithError(c, "tag", "busybox:latest", "-index:5000/busybox:test") |
|
| 109 |
+ out, _, err = dockerCmdWithError("tag", "busybox:latest", "-index:5000/busybox:test")
|
|
| 110 | 110 |
if err == nil || !strings.Contains(out, "Invalid index name (-index:5000). Cannot begin or end with a hyphen") {
|
| 111 | 111 |
c.Fatal("tag a name begin with '-' should failed")
|
| 112 | 112 |
} |
| ... | ... |
@@ -124,14 +124,14 @@ func (s *DockerSuite) TestTagOfficialNames(c *check.C) {
|
| 124 | 124 |
} |
| 125 | 125 |
|
| 126 | 126 |
for _, name := range names {
|
| 127 |
- out, exitCode, err := dockerCmdWithError(c, "tag", "-f", "busybox:latest", name+":latest") |
|
| 127 |
+ out, exitCode, err := dockerCmdWithError("tag", "-f", "busybox:latest", name+":latest")
|
|
| 128 | 128 |
if err != nil || exitCode != 0 {
|
| 129 | 129 |
c.Errorf("tag busybox %v should have worked: %s, %s", name, err, out)
|
| 130 | 130 |
continue |
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 | 133 |
// ensure we don't have multiple tag names. |
| 134 |
- out, _, err = dockerCmdWithError(c, "images") |
|
| 134 |
+ out, _, err = dockerCmdWithError("images")
|
|
| 135 | 135 |
if err != nil {
|
| 136 | 136 |
c.Errorf("listing images failed with errors: %v, %s", err, out)
|
| 137 | 137 |
} else if strings.Contains(out, name) {
|
| ... | ... |
@@ -141,7 +141,7 @@ func (s *DockerSuite) TestTagOfficialNames(c *check.C) {
|
| 141 | 141 |
} |
| 142 | 142 |
|
| 143 | 143 |
for _, name := range names {
|
| 144 |
- _, exitCode, err := dockerCmdWithError(c, "tag", "-f", name+":latest", "fooo/bar:latest") |
|
| 144 |
+ _, exitCode, err := dockerCmdWithError("tag", "-f", name+":latest", "fooo/bar:latest")
|
|
| 145 | 145 |
if err != nil || exitCode != 0 {
|
| 146 | 146 |
c.Errorf("tag %v fooo/bar should have worked: %s", name, err)
|
| 147 | 147 |
continue |
| ... | ... |
@@ -581,7 +581,7 @@ func pullImageIfNotExist(image string) (err error) {
|
| 581 | 581 |
return |
| 582 | 582 |
} |
| 583 | 583 |
|
| 584 |
-func dockerCmdWithError(c *check.C, args ...string) (string, int, error) {
|
|
| 584 |
+func dockerCmdWithError(args ...string) (string, int, error) {
|
|
| 585 | 585 |
return runCommandWithOutput(exec.Command(dockerBinary, args...)) |
| 586 | 586 |
} |
| 587 | 587 |
|