Changed method declaration. Fixed all calls to dockerCmd
method to reflect the change.
resolves #12355
Signed-off-by: bobby abbott <ttobbaybbob@gmail.com>
| ... | ... |
@@ -627,7 +627,7 @@ func TestContainerApiPause(t *testing.T) {
|
| 627 | 627 |
|
| 628 | 628 |
func TestContainerApiTop(t *testing.T) {
|
| 629 | 629 |
defer deleteAllContainers() |
| 630 |
- out, _, _ := dockerCmd(t, "run", "-d", "-i", "busybox", "/bin/sh", "-c", "cat") |
|
| 630 |
+ out, _ := dockerCmd(t, "run", "-d", "-i", "busybox", "/bin/sh", "-c", "cat") |
|
| 631 | 631 |
id := strings.TrimSpace(out) |
| 632 | 632 |
if err := waitRun(id); err != nil {
|
| 633 | 633 |
t.Fatal(err) |
| ... | ... |
@@ -667,7 +667,7 @@ func TestContainerApiTop(t *testing.T) {
|
| 667 | 667 |
} |
| 668 | 668 |
|
| 669 | 669 |
func TestContainerApiCommit(t *testing.T) {
|
| 670 |
- out, _, _ := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch /test") |
|
| 670 |
+ out, _ := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch /test") |
|
| 671 | 671 |
id := strings.TrimSpace(out) |
| 672 | 672 |
|
| 673 | 673 |
name := "testcommit" |
| ... | ... |
@@ -714,7 +714,7 @@ func TestContainerApiCreate(t *testing.T) {
|
| 714 | 714 |
t.Fatal(err) |
| 715 | 715 |
} |
| 716 | 716 |
|
| 717 |
- out, _, _ := dockerCmd(t, "start", "-a", container.Id) |
|
| 717 |
+ out, _ := dockerCmd(t, "start", "-a", container.Id) |
|
| 718 | 718 |
if strings.TrimSpace(out) != "/test" {
|
| 719 | 719 |
t.Fatalf("expected output `/test`, got %q", out)
|
| 720 | 720 |
} |
| ... | ... |
@@ -91,7 +91,7 @@ func TestApiImagesSaveAndLoad(t *testing.T) {
|
| 91 | 91 |
} |
| 92 | 92 |
defer loadBody.Close() |
| 93 | 93 |
|
| 94 |
- out, _, _ = dockerCmd(t, "inspect", "--format='{{ .Id }}'", id)
|
|
| 94 |
+ out, _ = dockerCmd(t, "inspect", "--format='{{ .Id }}'", id)
|
|
| 95 | 95 |
if strings.TrimSpace(out) != id {
|
| 96 | 96 |
t.Fatal("load did not work properly")
|
| 97 | 97 |
} |
| ... | ... |
@@ -138,7 +138,7 @@ func TestAttachTtyWithoutStdin(t *testing.T) {
|
| 138 | 138 |
|
| 139 | 139 |
func TestAttachDisconnect(t *testing.T) {
|
| 140 | 140 |
defer deleteAllContainers() |
| 141 |
- out, _, _ := dockerCmd(t, "run", "-di", "busybox", "/bin/cat") |
|
| 141 |
+ out, _ := dockerCmd(t, "run", "-di", "busybox", "/bin/cat") |
|
| 142 | 142 |
id := strings.TrimSpace(out) |
| 143 | 143 |
|
| 144 | 144 |
cmd := exec.Command(dockerBinary, "attach", id) |
| ... | ... |
@@ -142,7 +142,7 @@ func TestAttachAfterDetach(t *testing.T) {
|
| 142 | 142 |
|
| 143 | 143 |
// TestAttachDetach checks that attach in tty mode can be detached using the long container ID |
| 144 | 144 |
func TestAttachDetach(t *testing.T) {
|
| 145 |
- out, _, _ := dockerCmd(t, "run", "-itd", "busybox", "cat") |
|
| 145 |
+ out, _ := dockerCmd(t, "run", "-itd", "busybox", "cat") |
|
| 146 | 146 |
id := strings.TrimSpace(out) |
| 147 | 147 |
if err := waitRun(id); err != nil {
|
| 148 | 148 |
t.Fatal(err) |
| ... | ... |
@@ -217,7 +217,7 @@ func TestAttachDetach(t *testing.T) {
|
| 217 | 217 |
|
| 218 | 218 |
// TestAttachDetachTruncatedID checks that attach in tty mode can be detached |
| 219 | 219 |
func TestAttachDetachTruncatedID(t *testing.T) {
|
| 220 |
- out, _, _ := dockerCmd(t, "run", "-itd", "busybox", "cat") |
|
| 220 |
+ out, _ := dockerCmd(t, "run", "-itd", "busybox", "cat") |
|
| 221 | 221 |
id := stringid.TruncateID(strings.TrimSpace(out)) |
| 222 | 222 |
if err := waitRun(id); err != nil {
|
| 223 | 223 |
t.Fatal(err) |
| ... | ... |
@@ -3294,7 +3294,7 @@ func TestBuildNoContext(t *testing.T) {
|
| 3294 | 3294 |
t.Fatalf("build failed to complete: %v %v", out, err)
|
| 3295 | 3295 |
} |
| 3296 | 3296 |
|
| 3297 |
- if out, _, err := dockerCmd(t, "run", "--rm", "nocontext"); out != "ok\n" || err != nil {
|
|
| 3297 |
+ if out, _ := dockerCmd(t, "run", "--rm", "nocontext"); out != "ok\n" {
|
|
| 3298 | 3298 |
t.Fatalf("run produced invalid output: %q, expected %q", out, "ok")
|
| 3299 | 3299 |
} |
| 3300 | 3300 |
|
| ... | ... |
@@ -5562,10 +5562,7 @@ func TestBuildResourceConstraintsAreUsed(t *testing.T) {
|
| 5562 | 5562 |
if err != nil {
|
| 5563 | 5563 |
t.Fatal(err, out) |
| 5564 | 5564 |
} |
| 5565 |
- out, _, err = dockerCmd(t, "ps", "-lq") |
|
| 5566 |
- if err != nil {
|
|
| 5567 |
- t.Fatal(err, out) |
|
| 5568 |
- } |
|
| 5565 |
+ out, _ = dockerCmd(t, "ps", "-lq") |
|
| 5569 | 5566 |
|
| 5570 | 5567 |
cID := strings.TrimSpace(out) |
| 5571 | 5568 |
|
| ... | ... |
@@ -5593,10 +5590,8 @@ func TestBuildResourceConstraintsAreUsed(t *testing.T) {
|
| 5593 | 5593 |
} |
| 5594 | 5594 |
|
| 5595 | 5595 |
// Make sure constraints aren't saved to image |
| 5596 |
- _, _, err = dockerCmd(t, "run", "--name=test", name) |
|
| 5597 |
- if err != nil {
|
|
| 5598 |
- t.Fatal(err) |
|
| 5599 |
- } |
|
| 5596 |
+ _, _ = dockerCmd(t, "run", "--name=test", name) |
|
| 5597 |
+ |
|
| 5600 | 5598 |
cfg, err = inspectFieldJSON("test", "HostConfig")
|
| 5601 | 5599 |
if err != nil {
|
| 5602 | 5600 |
t.Fatal(err) |
| ... | ... |
@@ -284,13 +284,13 @@ func TestCommitChange(t *testing.T) {
|
| 284 | 284 |
func TestCommitMergeConfigRun(t *testing.T) {
|
| 285 | 285 |
defer deleteAllContainers() |
| 286 | 286 |
name := "commit-test" |
| 287 |
- out, _, _ := dockerCmd(t, "run", "-d", "-e=FOO=bar", "busybox", "/bin/sh", "-c", "echo testing > /tmp/foo") |
|
| 287 |
+ out, _ := dockerCmd(t, "run", "-d", "-e=FOO=bar", "busybox", "/bin/sh", "-c", "echo testing > /tmp/foo") |
|
| 288 | 288 |
id := strings.TrimSpace(out) |
| 289 | 289 |
|
| 290 | 290 |
dockerCmd(t, "commit", `--run={"Cmd": ["cat", "/tmp/foo"]}`, id, "commit-test")
|
| 291 | 291 |
defer deleteImages("commit-test")
|
| 292 | 292 |
|
| 293 |
- out, _, _ = dockerCmd(t, "run", "--name", name, "commit-test") |
|
| 293 |
+ out, _ = dockerCmd(t, "run", "--name", name, "commit-test") |
|
| 294 | 294 |
if strings.TrimSpace(out) != "testing" {
|
| 295 | 295 |
t.Fatal("run config in commited container was not merged")
|
| 296 | 296 |
} |
| ... | ... |
@@ -25,17 +25,17 @@ const ( |
| 25 | 25 |
// Test for #5656 |
| 26 | 26 |
// Check that garbage paths don't escape the container's rootfs |
| 27 | 27 |
func TestCpGarbagePath(t *testing.T) {
|
| 28 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 29 |
- if err != nil || exitCode != 0 {
|
|
| 30 |
- t.Fatal("failed to create a container", out, err)
|
|
| 28 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 29 |
+ if exitCode != 0 {
|
|
| 30 |
+ t.Fatal("failed to create a container", out)
|
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 | 33 |
cleanedContainerID := strings.TrimSpace(out) |
| 34 | 34 |
defer deleteContainer(cleanedContainerID) |
| 35 | 35 |
|
| 36 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 37 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 38 |
- t.Fatal("failed to set up container", out, err)
|
|
| 36 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 37 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 38 |
+ t.Fatal("failed to set up container", out)
|
|
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 | 41 |
if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
|
| ... | ... |
@@ -61,10 +61,7 @@ func TestCpGarbagePath(t *testing.T) {
|
| 61 | 61 |
|
| 62 | 62 |
path := path.Join("../../../../../../../../../../../../", cpFullPath)
|
| 63 | 63 |
|
| 64 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 65 |
- if err != nil {
|
|
| 66 |
- t.Fatalf("couldn't copy from garbage path: %s:%s %s", cleanedContainerID, path, err)
|
|
| 67 |
- } |
|
| 64 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 68 | 65 |
|
| 69 | 66 |
file, _ := os.Open(tmpname) |
| 70 | 67 |
defer file.Close() |
| ... | ... |
@@ -87,17 +84,17 @@ func TestCpGarbagePath(t *testing.T) {
|
| 87 | 87 |
|
| 88 | 88 |
// Check that relative paths are relative to the container's rootfs |
| 89 | 89 |
func TestCpRelativePath(t *testing.T) {
|
| 90 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 91 |
- if err != nil || exitCode != 0 {
|
|
| 92 |
- t.Fatal("failed to create a container", out, err)
|
|
| 90 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 91 |
+ if exitCode != 0 {
|
|
| 92 |
+ t.Fatal("failed to create a container", out)
|
|
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 | 95 |
cleanedContainerID := strings.TrimSpace(out) |
| 96 | 96 |
defer deleteContainer(cleanedContainerID) |
| 97 | 97 |
|
| 98 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 99 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 100 |
- t.Fatal("failed to set up container", out, err)
|
|
| 98 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 99 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 100 |
+ t.Fatal("failed to set up container", out)
|
|
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 | 103 |
if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
|
| ... | ... |
@@ -131,10 +128,7 @@ func TestCpRelativePath(t *testing.T) {
|
| 131 | 131 |
t.Fatalf("path %s was assumed to be an absolute path", cpFullPath)
|
| 132 | 132 |
} |
| 133 | 133 |
|
| 134 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+relPath, tmpdir) |
|
| 135 |
- if err != nil {
|
|
| 136 |
- t.Fatalf("couldn't copy from relative path: %s:%s %s", cleanedContainerID, relPath, err)
|
|
| 137 |
- } |
|
| 134 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":"+relPath, tmpdir) |
|
| 138 | 135 |
|
| 139 | 136 |
file, _ := os.Open(tmpname) |
| 140 | 137 |
defer file.Close() |
| ... | ... |
@@ -157,17 +151,17 @@ func TestCpRelativePath(t *testing.T) {
|
| 157 | 157 |
|
| 158 | 158 |
// Check that absolute paths are relative to the container's rootfs |
| 159 | 159 |
func TestCpAbsolutePath(t *testing.T) {
|
| 160 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 161 |
- if err != nil || exitCode != 0 {
|
|
| 162 |
- t.Fatal("failed to create a container", out, err)
|
|
| 160 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 161 |
+ if exitCode != 0 {
|
|
| 162 |
+ t.Fatal("failed to create a container", out)
|
|
| 163 | 163 |
} |
| 164 | 164 |
|
| 165 | 165 |
cleanedContainerID := strings.TrimSpace(out) |
| 166 | 166 |
defer deleteContainer(cleanedContainerID) |
| 167 | 167 |
|
| 168 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 169 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 170 |
- t.Fatal("failed to set up container", out, err)
|
|
| 168 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 169 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 170 |
+ t.Fatal("failed to set up container", out)
|
|
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 | 173 |
if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
|
| ... | ... |
@@ -194,10 +188,7 @@ func TestCpAbsolutePath(t *testing.T) {
|
| 194 | 194 |
|
| 195 | 195 |
path := cpFullPath |
| 196 | 196 |
|
| 197 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 198 |
- if err != nil {
|
|
| 199 |
- t.Fatalf("couldn't copy from absolute path: %s:%s %s", cleanedContainerID, path, err)
|
|
| 200 |
- } |
|
| 197 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 201 | 198 |
|
| 202 | 199 |
file, _ := os.Open(tmpname) |
| 203 | 200 |
defer file.Close() |
| ... | ... |
@@ -221,17 +212,17 @@ func TestCpAbsolutePath(t *testing.T) {
|
| 221 | 221 |
// Test for #5619 |
| 222 | 222 |
// Check that absolute symlinks are still relative to the container's rootfs |
| 223 | 223 |
func TestCpAbsoluteSymlink(t *testing.T) {
|
| 224 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path") |
|
| 225 |
- if err != nil || exitCode != 0 {
|
|
| 226 |
- t.Fatal("failed to create a container", out, err)
|
|
| 224 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path") |
|
| 225 |
+ if exitCode != 0 {
|
|
| 226 |
+ t.Fatal("failed to create a container", out)
|
|
| 227 | 227 |
} |
| 228 | 228 |
|
| 229 | 229 |
cleanedContainerID := strings.TrimSpace(out) |
| 230 | 230 |
defer deleteContainer(cleanedContainerID) |
| 231 | 231 |
|
| 232 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 233 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 234 |
- t.Fatal("failed to set up container", out, err)
|
|
| 232 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 233 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 234 |
+ t.Fatal("failed to set up container", out)
|
|
| 235 | 235 |
} |
| 236 | 236 |
|
| 237 | 237 |
if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
|
| ... | ... |
@@ -258,10 +249,7 @@ func TestCpAbsoluteSymlink(t *testing.T) {
|
| 258 | 258 |
|
| 259 | 259 |
path := path.Join("/", "container_path")
|
| 260 | 260 |
|
| 261 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 262 |
- if err != nil {
|
|
| 263 |
- t.Fatalf("couldn't copy from absolute path: %s:%s %s", cleanedContainerID, path, err)
|
|
| 264 |
- } |
|
| 261 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 265 | 262 |
|
| 266 | 263 |
file, _ := os.Open(tmpname) |
| 267 | 264 |
defer file.Close() |
| ... | ... |
@@ -285,17 +273,17 @@ func TestCpAbsoluteSymlink(t *testing.T) {
|
| 285 | 285 |
// Test for #5619 |
| 286 | 286 |
// Check that symlinks which are part of the resource path are still relative to the container's rootfs |
| 287 | 287 |
func TestCpSymlinkComponent(t *testing.T) {
|
| 288 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path") |
|
| 289 |
- if err != nil || exitCode != 0 {
|
|
| 290 |
- t.Fatal("failed to create a container", out, err)
|
|
| 288 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path") |
|
| 289 |
+ if exitCode != 0 {
|
|
| 290 |
+ t.Fatal("failed to create a container", out)
|
|
| 291 | 291 |
} |
| 292 | 292 |
|
| 293 | 293 |
cleanedContainerID := strings.TrimSpace(out) |
| 294 | 294 |
defer deleteContainer(cleanedContainerID) |
| 295 | 295 |
|
| 296 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 297 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 298 |
- t.Fatal("failed to set up container", out, err)
|
|
| 296 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 297 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 298 |
+ t.Fatal("failed to set up container", out)
|
|
| 299 | 299 |
} |
| 300 | 300 |
|
| 301 | 301 |
if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
|
| ... | ... |
@@ -322,10 +310,7 @@ func TestCpSymlinkComponent(t *testing.T) {
|
| 322 | 322 |
|
| 323 | 323 |
path := path.Join("/", "container_path", cpTestName)
|
| 324 | 324 |
|
| 325 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 326 |
- if err != nil {
|
|
| 327 |
- t.Fatalf("couldn't copy from symlink path component: %s:%s %s", cleanedContainerID, path, err)
|
|
| 328 |
- } |
|
| 325 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 329 | 326 |
|
| 330 | 327 |
file, _ := os.Open(tmpname) |
| 331 | 328 |
defer file.Close() |
| ... | ... |
@@ -350,17 +335,17 @@ func TestCpSymlinkComponent(t *testing.T) {
|
| 350 | 350 |
func TestCpUnprivilegedUser(t *testing.T) {
|
| 351 | 351 |
testRequires(t, UnixCli) // uses chmod/su: not available on windows |
| 352 | 352 |
|
| 353 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName) |
|
| 354 |
- if err != nil || exitCode != 0 {
|
|
| 355 |
- t.Fatal("failed to create a container", out, err)
|
|
| 353 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName) |
|
| 354 |
+ if exitCode != 0 {
|
|
| 355 |
+ t.Fatal("failed to create a container", out)
|
|
| 356 | 356 |
} |
| 357 | 357 |
|
| 358 | 358 |
cleanedContainerID := strings.TrimSpace(out) |
| 359 | 359 |
defer deleteContainer(cleanedContainerID) |
| 360 | 360 |
|
| 361 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 362 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 363 |
- t.Fatal("failed to set up container", out, err)
|
|
| 361 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 362 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 363 |
+ t.Fatal("failed to set up container", out)
|
|
| 364 | 364 |
} |
| 365 | 365 |
|
| 366 | 366 |
tmpdir, err := ioutil.TempDir("", "docker-integration")
|
| ... | ... |
@@ -393,24 +378,21 @@ func TestCpSpecialFiles(t *testing.T) {
|
| 393 | 393 |
} |
| 394 | 394 |
defer os.RemoveAll(outDir) |
| 395 | 395 |
|
| 396 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch /foo") |
|
| 397 |
- if err != nil || exitCode != 0 {
|
|
| 398 |
- t.Fatal("failed to create a container", out, err)
|
|
| 396 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch /foo") |
|
| 397 |
+ if exitCode != 0 {
|
|
| 398 |
+ t.Fatal("failed to create a container", out)
|
|
| 399 | 399 |
} |
| 400 | 400 |
|
| 401 | 401 |
cleanedContainerID := strings.TrimSpace(out) |
| 402 | 402 |
defer deleteContainer(cleanedContainerID) |
| 403 | 403 |
|
| 404 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 405 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 406 |
- t.Fatal("failed to set up container", out, err)
|
|
| 404 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 405 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 406 |
+ t.Fatal("failed to set up container", out)
|
|
| 407 | 407 |
} |
| 408 | 408 |
|
| 409 | 409 |
// Copy actual /etc/resolv.conf |
| 410 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/etc/resolv.conf", outDir) |
|
| 411 |
- if err != nil {
|
|
| 412 |
- t.Fatalf("couldn't copy from container: %s:%s %v", cleanedContainerID, "/etc/resolv.conf", err)
|
|
| 413 |
- } |
|
| 410 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/etc/resolv.conf", outDir) |
|
| 414 | 411 |
|
| 415 | 412 |
expected, err := ioutil.ReadFile("/var/lib/docker/containers/" + cleanedContainerID + "/resolv.conf")
|
| 416 | 413 |
actual, err := ioutil.ReadFile(outDir + "/resolv.conf") |
| ... | ... |
@@ -420,10 +402,7 @@ func TestCpSpecialFiles(t *testing.T) {
|
| 420 | 420 |
} |
| 421 | 421 |
|
| 422 | 422 |
// Copy actual /etc/hosts |
| 423 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/etc/hosts", outDir) |
|
| 424 |
- if err != nil {
|
|
| 425 |
- t.Fatalf("couldn't copy from container: %s:%s %v", cleanedContainerID, "/etc/hosts", err)
|
|
| 426 |
- } |
|
| 423 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/etc/hosts", outDir) |
|
| 427 | 424 |
|
| 428 | 425 |
expected, err = ioutil.ReadFile("/var/lib/docker/containers/" + cleanedContainerID + "/hosts")
|
| 429 | 426 |
actual, err = ioutil.ReadFile(outDir + "/hosts") |
| ... | ... |
@@ -433,10 +412,7 @@ func TestCpSpecialFiles(t *testing.T) {
|
| 433 | 433 |
} |
| 434 | 434 |
|
| 435 | 435 |
// Copy actual /etc/resolv.conf |
| 436 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/etc/hostname", outDir) |
|
| 437 |
- if err != nil {
|
|
| 438 |
- t.Fatalf("couldn't copy from container: %s:%s %v", cleanedContainerID, "/etc/hostname", err)
|
|
| 439 |
- } |
|
| 436 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/etc/hostname", outDir) |
|
| 440 | 437 |
|
| 441 | 438 |
expected, err = ioutil.ReadFile("/var/lib/docker/containers/" + cleanedContainerID + "/hostname")
|
| 442 | 439 |
actual, err = ioutil.ReadFile(outDir + "/hostname") |
| ... | ... |
@@ -466,24 +442,22 @@ func TestCpVolumePath(t *testing.T) {
|
| 466 | 466 |
t.Fatal(err) |
| 467 | 467 |
} |
| 468 | 468 |
|
| 469 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "-v", "/foo", "-v", tmpDir+"/test:/test", "-v", tmpDir+":/baz", "busybox", "/bin/sh", "-c", "touch /foo/bar") |
|
| 470 |
- if err != nil || exitCode != 0 {
|
|
| 471 |
- t.Fatal("failed to create a container", out, err)
|
|
| 469 |
+ out, exitCode := dockerCmd(t, "run", "-d", "-v", "/foo", "-v", tmpDir+"/test:/test", "-v", tmpDir+":/baz", "busybox", "/bin/sh", "-c", "touch /foo/bar") |
|
| 470 |
+ if exitCode != 0 {
|
|
| 471 |
+ t.Fatal("failed to create a container", out)
|
|
| 472 | 472 |
} |
| 473 | 473 |
|
| 474 | 474 |
cleanedContainerID := strings.TrimSpace(out) |
| 475 | 475 |
defer dockerCmd(t, "rm", "-fv", cleanedContainerID) |
| 476 | 476 |
|
| 477 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 478 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 479 |
- t.Fatal("failed to set up container", out, err)
|
|
| 477 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 478 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 479 |
+ t.Fatal("failed to set up container", out)
|
|
| 480 | 480 |
} |
| 481 | 481 |
|
| 482 | 482 |
// Copy actual volume path |
| 483 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/foo", outDir) |
|
| 484 |
- if err != nil {
|
|
| 485 |
- t.Fatalf("couldn't copy from volume path: %s:%s %v", cleanedContainerID, "/foo", err)
|
|
| 486 |
- } |
|
| 483 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/foo", outDir) |
|
| 484 |
+ |
|
| 487 | 485 |
stat, err := os.Stat(outDir + "/foo") |
| 488 | 486 |
if err != nil {
|
| 489 | 487 |
t.Fatal(err) |
| ... | ... |
@@ -500,10 +474,8 @@ func TestCpVolumePath(t *testing.T) {
|
| 500 | 500 |
} |
| 501 | 501 |
|
| 502 | 502 |
// Copy file nested in volume |
| 503 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/foo/bar", outDir) |
|
| 504 |
- if err != nil {
|
|
| 505 |
- t.Fatalf("couldn't copy from volume path: %s:%s %v", cleanedContainerID, "/foo", err)
|
|
| 506 |
- } |
|
| 503 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/foo/bar", outDir) |
|
| 504 |
+ |
|
| 507 | 505 |
stat, err = os.Stat(outDir + "/bar") |
| 508 | 506 |
if err != nil {
|
| 509 | 507 |
t.Fatal(err) |
| ... | ... |
@@ -513,10 +485,7 @@ func TestCpVolumePath(t *testing.T) {
|
| 513 | 513 |
} |
| 514 | 514 |
|
| 515 | 515 |
// Copy Bind-mounted dir |
| 516 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/baz", outDir) |
|
| 517 |
- if err != nil {
|
|
| 518 |
- t.Fatalf("couldn't copy from bind-mounted volume path: %s:%s %v", cleanedContainerID, "/baz", err)
|
|
| 519 |
- } |
|
| 516 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/baz", outDir) |
|
| 520 | 517 |
stat, err = os.Stat(outDir + "/baz") |
| 521 | 518 |
if err != nil {
|
| 522 | 519 |
t.Fatal(err) |
| ... | ... |
@@ -526,7 +495,7 @@ func TestCpVolumePath(t *testing.T) {
|
| 526 | 526 |
} |
| 527 | 527 |
|
| 528 | 528 |
// Copy file nested in bind-mounted dir |
| 529 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/baz/test", outDir) |
|
| 529 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/baz/test", outDir) |
|
| 530 | 530 |
fb, err := ioutil.ReadFile(outDir + "/baz/test") |
| 531 | 531 |
if err != nil {
|
| 532 | 532 |
t.Fatal(err) |
| ... | ... |
@@ -540,7 +509,7 @@ func TestCpVolumePath(t *testing.T) {
|
| 540 | 540 |
} |
| 541 | 541 |
|
| 542 | 542 |
// Copy bind-mounted file |
| 543 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/test", outDir) |
|
| 543 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/test", outDir) |
|
| 544 | 544 |
fb, err = ioutil.ReadFile(outDir + "/test") |
| 545 | 545 |
if err != nil {
|
| 546 | 546 |
t.Fatal(err) |
| ... | ... |
@@ -557,17 +526,17 @@ func TestCpVolumePath(t *testing.T) {
|
| 557 | 557 |
} |
| 558 | 558 |
|
| 559 | 559 |
func TestCpToDot(t *testing.T) {
|
| 560 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test") |
|
| 561 |
- if err != nil || exitCode != 0 {
|
|
| 562 |
- t.Fatal("failed to create a container", out, err)
|
|
| 560 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test") |
|
| 561 |
+ if exitCode != 0 {
|
|
| 562 |
+ t.Fatal("failed to create a container", out)
|
|
| 563 | 563 |
} |
| 564 | 564 |
|
| 565 | 565 |
cleanedContainerID := strings.TrimSpace(out) |
| 566 | 566 |
defer deleteContainer(cleanedContainerID) |
| 567 | 567 |
|
| 568 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 569 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 570 |
- t.Fatal("failed to set up container", out, err)
|
|
| 568 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 569 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 570 |
+ t.Fatal("failed to set up container", out)
|
|
| 571 | 571 |
} |
| 572 | 572 |
|
| 573 | 573 |
tmpdir, err := ioutil.TempDir("", "docker-integration")
|
| ... | ... |
@@ -583,10 +552,7 @@ func TestCpToDot(t *testing.T) {
|
| 583 | 583 |
if err := os.Chdir(tmpdir); err != nil {
|
| 584 | 584 |
t.Fatal(err) |
| 585 | 585 |
} |
| 586 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/test", ".") |
|
| 587 |
- if err != nil {
|
|
| 588 |
- t.Fatalf("couldn't docker cp to \".\" path: %s", err)
|
|
| 589 |
- } |
|
| 586 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/test", ".") |
|
| 590 | 587 |
content, err := ioutil.ReadFile("./test")
|
| 591 | 588 |
if string(content) != "lololol\n" {
|
| 592 | 589 |
t.Fatalf("Wrong content in copied file %q, should be %q", content, "lololol\n")
|
| ... | ... |
@@ -595,22 +561,23 @@ func TestCpToDot(t *testing.T) {
|
| 595 | 595 |
} |
| 596 | 596 |
|
| 597 | 597 |
func TestCpToStdout(t *testing.T) {
|
| 598 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test") |
|
| 599 |
- if err != nil || exitCode != 0 {
|
|
| 600 |
- t.Fatalf("failed to create a container:%s\n%s", out, err)
|
|
| 598 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test") |
|
| 599 |
+ if exitCode != 0 {
|
|
| 600 |
+ t.Fatalf("failed to create a container:%s\n", out)
|
|
| 601 | 601 |
} |
| 602 | 602 |
|
| 603 | 603 |
cID := strings.TrimSpace(out) |
| 604 | 604 |
defer deleteContainer(cID) |
| 605 | 605 |
|
| 606 |
- out, _, err = dockerCmd(t, "wait", cID) |
|
| 607 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 608 |
- t.Fatalf("failed to set up container:%s\n%s", out, err)
|
|
| 606 |
+ out, _ = dockerCmd(t, "wait", cID) |
|
| 607 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 608 |
+ t.Fatalf("failed to set up container:%s\n", out)
|
|
| 609 | 609 |
} |
| 610 | 610 |
|
| 611 |
- out, _, err = runCommandPipelineWithOutput( |
|
| 611 |
+ out, _, err := runCommandPipelineWithOutput( |
|
| 612 | 612 |
exec.Command(dockerBinary, "cp", cID+":/test", "-"), |
| 613 | 613 |
exec.Command("tar", "-vtf", "-"))
|
| 614 |
+ |
|
| 614 | 615 |
if err != nil {
|
| 615 | 616 |
t.Fatalf("Failed to run commands: %s", err)
|
| 616 | 617 |
} |
| ... | ... |
@@ -624,17 +591,17 @@ func TestCpToStdout(t *testing.T) {
|
| 624 | 624 |
func TestCpNameHasColon(t *testing.T) {
|
| 625 | 625 |
testRequires(t, SameHostDaemon) |
| 626 | 626 |
|
| 627 |
- out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /te:s:t") |
|
| 628 |
- if err != nil || exitCode != 0 {
|
|
| 629 |
- t.Fatal("failed to create a container", out, err)
|
|
| 627 |
+ out, exitCode := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /te:s:t") |
|
| 628 |
+ if exitCode != 0 {
|
|
| 629 |
+ t.Fatal("failed to create a container", out)
|
|
| 630 | 630 |
} |
| 631 | 631 |
|
| 632 | 632 |
cleanedContainerID := strings.TrimSpace(out) |
| 633 | 633 |
defer deleteContainer(cleanedContainerID) |
| 634 | 634 |
|
| 635 |
- out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 636 |
- if err != nil || strings.TrimSpace(out) != "0" {
|
|
| 637 |
- t.Fatal("failed to set up container", out, err)
|
|
| 635 |
+ out, _ = dockerCmd(t, "wait", cleanedContainerID) |
|
| 636 |
+ if strings.TrimSpace(out) != "0" {
|
|
| 637 |
+ t.Fatal("failed to set up container", out)
|
|
| 638 | 638 |
} |
| 639 | 639 |
|
| 640 | 640 |
tmpdir, err := ioutil.TempDir("", "docker-integration")
|
| ... | ... |
@@ -642,10 +609,7 @@ func TestCpNameHasColon(t *testing.T) {
|
| 642 | 642 |
t.Fatal(err) |
| 643 | 643 |
} |
| 644 | 644 |
defer os.RemoveAll(tmpdir) |
| 645 |
- _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/te:s:t", tmpdir) |
|
| 646 |
- if err != nil {
|
|
| 647 |
- t.Fatalf("couldn't docker cp to %s: %s", tmpdir, err)
|
|
| 648 |
- } |
|
| 645 |
+ _, _ = dockerCmd(t, "cp", cleanedContainerID+":/te:s:t", tmpdir) |
|
| 649 | 646 |
content, err := ioutil.ReadFile(tmpdir + "/te:s:t") |
| 650 | 647 |
if string(content) != "lololol\n" {
|
| 651 | 648 |
t.Fatalf("Wrong content in copied file %q, should be %q", content, "lololol\n")
|
| ... | ... |
@@ -307,7 +307,7 @@ func TestCreateLabelFromImage(t *testing.T) {
|
| 307 | 307 |
} |
| 308 | 308 |
|
| 309 | 309 |
func TestCreateHostnameWithNumber(t *testing.T) {
|
| 310 |
- out, _, _ := dockerCmd(t, "run", "-h", "web.0", "busybox", "hostname") |
|
| 310 |
+ out, _ := dockerCmd(t, "run", "-h", "web.0", "busybox", "hostname") |
|
| 311 | 311 |
if strings.TrimSpace(out) != "web.0" {
|
| 312 | 312 |
t.Fatalf("hostname not set, expected `web.0`, got: %s", out)
|
| 313 | 313 |
} |
| ... | ... |
@@ -38,7 +38,7 @@ func TestEventsUntag(t *testing.T) {
|
| 38 | 38 |
func TestEventsContainerFailStartDie(t *testing.T) {
|
| 39 | 39 |
defer deleteAllContainers() |
| 40 | 40 |
|
| 41 |
- out, _, _ := dockerCmd(t, "images", "-q") |
|
| 41 |
+ out, _ := dockerCmd(t, "images", "-q") |
|
| 42 | 42 |
image := strings.Split(out, "\n")[0] |
| 43 | 43 |
eventsCmd := exec.Command(dockerBinary, "run", "--name", "testeventdie", image, "blerg") |
| 44 | 44 |
_, _, err := runCommandWithOutput(eventsCmd) |
| ... | ... |
@@ -500,12 +500,12 @@ func TestLinksPingLinkedContainersOnRename(t *testing.T) {
|
| 500 | 500 |
defer deleteAllContainers() |
| 501 | 501 |
|
| 502 | 502 |
var out string |
| 503 |
- out, _, _ = dockerCmd(t, "run", "-d", "--name", "container1", "busybox", "top") |
|
| 503 |
+ out, _ = dockerCmd(t, "run", "-d", "--name", "container1", "busybox", "top") |
|
| 504 | 504 |
idA := strings.TrimSpace(out) |
| 505 | 505 |
if idA == "" {
|
| 506 | 506 |
t.Fatal(out, "id should not be nil") |
| 507 | 507 |
} |
| 508 |
- out, _, _ = dockerCmd(t, "run", "-d", "--link", "container1:alias1", "--name", "container2", "busybox", "top") |
|
| 508 |
+ out, _ = dockerCmd(t, "run", "-d", "--link", "container1:alias1", "--name", "container2", "busybox", "top") |
|
| 509 | 509 |
idB := strings.TrimSpace(out) |
| 510 | 510 |
if idB == "" {
|
| 511 | 511 |
t.Fatal(out, "id should not be nil") |
| ... | ... |
@@ -110,9 +110,9 @@ func TestLinksPingLinkedContainers(t *testing.T) {
|
| 110 | 110 |
func TestLinksPingLinkedContainersAfterRename(t *testing.T) {
|
| 111 | 111 |
defer deleteAllContainers() |
| 112 | 112 |
|
| 113 |
- out, _, _ := dockerCmd(t, "run", "-d", "--name", "container1", "busybox", "top") |
|
| 113 |
+ out, _ := dockerCmd(t, "run", "-d", "--name", "container1", "busybox", "top") |
|
| 114 | 114 |
idA := strings.TrimSpace(out) |
| 115 |
- out, _, _ = dockerCmd(t, "run", "-d", "--name", "container2", "busybox", "top") |
|
| 115 |
+ out, _ = dockerCmd(t, "run", "-d", "--name", "container2", "busybox", "top") |
|
| 116 | 116 |
idB := strings.TrimSpace(out) |
| 117 | 117 |
dockerCmd(t, "rename", "container1", "container_new") |
| 118 | 118 |
dockerCmd(t, "run", "--rm", "--link", "container_new:alias1", "--link", "container2:alias2", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1") |
| ... | ... |
@@ -12,7 +12,7 @@ func TestPause(t *testing.T) {
|
| 12 | 12 |
defer unpauseAllContainers() |
| 13 | 13 |
|
| 14 | 14 |
name := "testeventpause" |
| 15 |
- out, _, _ := dockerCmd(t, "images", "-q") |
|
| 15 |
+ out, _ := dockerCmd(t, "images", "-q") |
|
| 16 | 16 |
image := strings.Split(out, "\n")[0] |
| 17 | 17 |
dockerCmd(t, "run", "-d", "--name", name, image, "top") |
| 18 | 18 |
|
| ... | ... |
@@ -55,7 +55,7 @@ func TestPauseMultipleContainers(t *testing.T) {
|
| 55 | 55 |
"testpausewithmorecontainers1", |
| 56 | 56 |
"testpausewithmorecontainers2", |
| 57 | 57 |
} |
| 58 |
- out, _, _ := dockerCmd(t, "images", "-q") |
|
| 58 |
+ out, _ := dockerCmd(t, "images", "-q") |
|
| 59 | 59 |
image := strings.Split(out, "\n")[0] |
| 60 | 60 |
for _, name := range containers {
|
| 61 | 61 |
dockerCmd(t, "run", "-d", "--name", name, image, "top") |
| ... | ... |
@@ -29,7 +29,7 @@ func TestRmiWithContainerFails(t *testing.T) {
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
// make sure it didn't delete the busybox name |
| 32 |
- images, _, _ := dockerCmd(t, "images") |
|
| 32 |
+ images, _ := dockerCmd(t, "images") |
|
| 33 | 33 |
if !strings.Contains(images, "busybox") {
|
| 34 | 34 |
t.Fatalf("The name 'busybox' should not have been removed from images: %q", images)
|
| 35 | 35 |
} |
| ... | ... |
@@ -40,19 +40,19 @@ func TestRmiWithContainerFails(t *testing.T) {
|
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 | 42 |
func TestRmiTag(t *testing.T) {
|
| 43 |
- imagesBefore, _, _ := dockerCmd(t, "images", "-a") |
|
| 43 |
+ imagesBefore, _ := dockerCmd(t, "images", "-a") |
|
| 44 | 44 |
dockerCmd(t, "tag", "busybox", "utest:tag1") |
| 45 | 45 |
dockerCmd(t, "tag", "busybox", "utest/docker:tag2") |
| 46 | 46 |
dockerCmd(t, "tag", "busybox", "utest:5000/docker:tag3") |
| 47 | 47 |
{
|
| 48 |
- imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 48 |
+ imagesAfter, _ := dockerCmd(t, "images", "-a") |
|
| 49 | 49 |
if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+3 {
|
| 50 | 50 |
t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
|
| 51 | 51 |
} |
| 52 | 52 |
} |
| 53 | 53 |
dockerCmd(t, "rmi", "utest/docker:tag2") |
| 54 | 54 |
{
|
| 55 |
- imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 55 |
+ imagesAfter, _ := dockerCmd(t, "images", "-a") |
|
| 56 | 56 |
if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+2 {
|
| 57 | 57 |
t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
|
| 58 | 58 |
} |
| ... | ... |
@@ -60,7 +60,7 @@ func TestRmiTag(t *testing.T) {
|
| 60 | 60 |
} |
| 61 | 61 |
dockerCmd(t, "rmi", "utest:5000/docker:tag3") |
| 62 | 62 |
{
|
| 63 |
- imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 63 |
+ imagesAfter, _ := dockerCmd(t, "images", "-a") |
|
| 64 | 64 |
if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+1 {
|
| 65 | 65 |
t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
|
| 66 | 66 |
} |
| ... | ... |
@@ -68,7 +68,7 @@ func TestRmiTag(t *testing.T) {
|
| 68 | 68 |
} |
| 69 | 69 |
dockerCmd(t, "rmi", "utest:tag1") |
| 70 | 70 |
{
|
| 71 |
- imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 71 |
+ imagesAfter, _ := dockerCmd(t, "images", "-a") |
|
| 72 | 72 |
if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+0 {
|
| 73 | 73 |
t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
|
| 74 | 74 |
} |
| ... | ... |
@@ -90,22 +90,22 @@ func TestRmiImgIDForce(t *testing.T) {
|
| 90 | 90 |
t.Fatalf("failed to commit a new busybox-test:%s, %v", out, err)
|
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 |
- imagesBefore, _, _ := dockerCmd(t, "images", "-a") |
|
| 93 |
+ imagesBefore, _ := dockerCmd(t, "images", "-a") |
|
| 94 | 94 |
dockerCmd(t, "tag", "busybox-test", "utest:tag1") |
| 95 | 95 |
dockerCmd(t, "tag", "busybox-test", "utest:tag2") |
| 96 | 96 |
dockerCmd(t, "tag", "busybox-test", "utest/docker:tag3") |
| 97 | 97 |
dockerCmd(t, "tag", "busybox-test", "utest:5000/docker:tag4") |
| 98 | 98 |
{
|
| 99 |
- imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 99 |
+ imagesAfter, _ := dockerCmd(t, "images", "-a") |
|
| 100 | 100 |
if strings.Count(imagesAfter, "\n") != strings.Count(imagesBefore, "\n")+4 {
|
| 101 | 101 |
t.Fatalf("tag busybox to create 4 more images with same imageID; docker images shows: %q\n", imagesAfter)
|
| 102 | 102 |
} |
| 103 | 103 |
} |
| 104 |
- out, _, _ = dockerCmd(t, "inspect", "-f", "{{.Id}}", "busybox-test")
|
|
| 104 |
+ out, _ = dockerCmd(t, "inspect", "-f", "{{.Id}}", "busybox-test")
|
|
| 105 | 105 |
imgID := strings.TrimSpace(out) |
| 106 | 106 |
dockerCmd(t, "rmi", "-f", imgID) |
| 107 | 107 |
{
|
| 108 |
- imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 108 |
+ imagesAfter, _ := dockerCmd(t, "images", "-a") |
|
| 109 | 109 |
if strings.Contains(imagesAfter, imgID[:12]) {
|
| 110 | 110 |
t.Fatalf("rmi -f %s failed, image still exists: %q\n\n", imgID, imagesAfter)
|
| 111 | 111 |
} |
| ... | ... |
@@ -501,9 +501,7 @@ func TestRunCreateVolumesInSymlinkDir(t *testing.T) {
|
| 501 | 501 |
} |
| 502 | 502 |
defer deleteImages(name) |
| 503 | 503 |
|
| 504 |
- if out, _, err := dockerCmd(t, "run", "-v", "/test/test", name); err != nil {
|
|
| 505 |
- t.Fatal(err, out) |
|
| 506 |
- } |
|
| 504 |
+ dockerCmd(t, "run", "-v", "/test/test", name) |
|
| 507 | 505 |
|
| 508 | 506 |
logDone("run - create volume in symlink directory")
|
| 509 | 507 |
} |
| ... | ... |
@@ -1058,9 +1056,9 @@ func TestRunLoopbackWhenNetworkDisabled(t *testing.T) {
|
| 1058 | 1058 |
func TestRunNetHostNotAllowedWithLinks(t *testing.T) {
|
| 1059 | 1059 |
defer deleteAllContainers() |
| 1060 | 1060 |
|
| 1061 |
- _, _, err := dockerCmd(t, "run", "--name", "linked", "busybox", "true") |
|
| 1061 |
+ _, _ = dockerCmd(t, "run", "--name", "linked", "busybox", "true") |
|
| 1062 | 1062 |
cmd := exec.Command(dockerBinary, "run", "--net=host", "--link", "linked:linked", "busybox", "true") |
| 1063 |
- _, _, err = runCommandWithOutput(cmd) |
|
| 1063 |
+ _, _, err := runCommandWithOutput(cmd) |
|
| 1064 | 1064 |
if err == nil {
|
| 1065 | 1065 |
t.Fatal("Expected error")
|
| 1066 | 1066 |
} |
| ... | ... |
@@ -1493,10 +1491,7 @@ func TestRunModeHostname(t *testing.T) {
|
| 1493 | 1493 |
func TestRunRootWorkdir(t *testing.T) {
|
| 1494 | 1494 |
defer deleteAllContainers() |
| 1495 | 1495 |
|
| 1496 |
- s, _, err := dockerCmd(t, "run", "--workdir", "/", "busybox", "pwd") |
|
| 1497 |
- if err != nil {
|
|
| 1498 |
- t.Fatal(s, err) |
|
| 1499 |
- } |
|
| 1496 |
+ s, _ := dockerCmd(t, "run", "--workdir", "/", "busybox", "pwd") |
|
| 1500 | 1497 |
if s != "/\n" {
|
| 1501 | 1498 |
t.Fatalf("pwd returned %q (expected /\\n)", s)
|
| 1502 | 1499 |
} |
| ... | ... |
@@ -1507,10 +1502,7 @@ func TestRunRootWorkdir(t *testing.T) {
|
| 1507 | 1507 |
func TestRunAllowBindMountingRoot(t *testing.T) {
|
| 1508 | 1508 |
defer deleteAllContainers() |
| 1509 | 1509 |
|
| 1510 |
- s, _, err := dockerCmd(t, "run", "-v", "/:/host", "busybox", "ls", "/host") |
|
| 1511 |
- if err != nil {
|
|
| 1512 |
- t.Fatal(s, err) |
|
| 1513 |
- } |
|
| 1510 |
+ _, _ = dockerCmd(t, "run", "-v", "/:/host", "busybox", "ls", "/host") |
|
| 1514 | 1511 |
|
| 1515 | 1512 |
logDone("run - bind mount / as volume")
|
| 1516 | 1513 |
} |
| ... | ... |
@@ -157,7 +157,7 @@ func TestStartVolumesFromFailsCleanly(t *testing.T) {
|
| 157 | 157 |
dockerCmd(t, "start", "consumer") |
| 158 | 158 |
|
| 159 | 159 |
// Check that we have the volumes we want |
| 160 |
- out, _, _ := dockerCmd(t, "inspect", "--format='{{ len .Volumes }}'", "consumer")
|
|
| 160 |
+ out, _ := dockerCmd(t, "inspect", "--format='{{ len .Volumes }}'", "consumer")
|
|
| 161 | 161 |
nVolumes := strings.Trim(out, " \r\n'") |
| 162 | 162 |
if nVolumes != "2" {
|
| 163 | 163 |
t.Fatalf("Missing volumes: expected 2, got %s", nVolumes)
|
| ... | ... |
@@ -478,12 +478,12 @@ func pullImageIfNotExist(image string) (err error) {
|
| 478 | 478 |
return |
| 479 | 479 |
} |
| 480 | 480 |
|
| 481 |
-func dockerCmd(t *testing.T, args ...string) (string, int, error) {
|
|
| 481 |
+func dockerCmd(t *testing.T, args ...string) (string, int) {
|
|
| 482 | 482 |
out, status, err := runCommandWithOutput(exec.Command(dockerBinary, args...)) |
| 483 | 483 |
if err != nil {
|
| 484 | 484 |
t.Fatalf("%q failed with errors: %s, %v", strings.Join(args, " "), out, err)
|
| 485 | 485 |
} |
| 486 |
- return out, status, err |
|
| 486 |
+ return out, status |
|
| 487 | 487 |
} |
| 488 | 488 |
|
| 489 | 489 |
// execute a docker command with a timeout |
| ... | ... |
@@ -784,9 +784,9 @@ func getContainerState(t *testing.T, id string) (int, bool, error) {
|
| 784 | 784 |
exitStatus int |
| 785 | 785 |
running bool |
| 786 | 786 |
) |
| 787 |
- out, exitCode, err := dockerCmd(t, "inspect", "--format={{.State.Running}} {{.State.ExitCode}}", id)
|
|
| 788 |
- if err != nil || exitCode != 0 {
|
|
| 789 |
- return 0, false, fmt.Errorf("%q doesn't exist: %s", id, err)
|
|
| 787 |
+ out, exitCode := dockerCmd(t, "inspect", "--format={{.State.Running}} {{.State.ExitCode}}", id)
|
|
| 788 |
+ if exitCode != 0 {
|
|
| 789 |
+ return 0, false, fmt.Errorf("%q doesn't exist: %s", id, out)
|
|
| 790 | 790 |
} |
| 791 | 791 |
|
| 792 | 792 |
out = strings.Trim(out, "\n") |