Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
| ... | ... |
@@ -2429,7 +2429,7 @@ func TestBuildNoContext(t *testing.T) {
|
| 2429 | 2429 |
t.Fatalf("build failed to complete: %v %v", out, err)
|
| 2430 | 2430 |
} |
| 2431 | 2431 |
|
| 2432 |
- if out, _, err := cmd(t, "run", "--rm", "nocontext"); out != "ok\n" || err != nil {
|
|
| 2432 |
+ if out, _, err := dockerCmd(t, "run", "--rm", "nocontext"); out != "ok\n" || err != nil {
|
|
| 2433 | 2433 |
t.Fatalf("run produced invalid output: %q, expected %q", out, "ok")
|
| 2434 | 2434 |
} |
| 2435 | 2435 |
|
| ... | ... |
@@ -23,7 +23,7 @@ const ( |
| 23 | 23 |
// Test for #5656 |
| 24 | 24 |
// Check that garbage paths don't escape the container's rootfs |
| 25 | 25 |
func TestCpGarbagePath(t *testing.T) {
|
| 26 |
- out, exitCode, err := cmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 26 |
+ out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 27 | 27 |
if err != nil || exitCode != 0 {
|
| 28 | 28 |
t.Fatal("failed to create a container", out, err)
|
| 29 | 29 |
} |
| ... | ... |
@@ -31,7 +31,7 @@ func TestCpGarbagePath(t *testing.T) {
|
| 31 | 31 |
cleanedContainerID := stripTrailingCharacters(out) |
| 32 | 32 |
defer deleteContainer(cleanedContainerID) |
| 33 | 33 |
|
| 34 |
- out, _, err = cmd(t, "wait", cleanedContainerID) |
|
| 34 |
+ out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 35 | 35 |
if err != nil || stripTrailingCharacters(out) != "0" {
|
| 36 | 36 |
t.Fatal("failed to set up container", out, err)
|
| 37 | 37 |
} |
| ... | ... |
@@ -59,7 +59,7 @@ func TestCpGarbagePath(t *testing.T) {
|
| 59 | 59 |
|
| 60 | 60 |
path := filepath.Join("../../../../../../../../../../../../", cpFullPath)
|
| 61 | 61 |
|
| 62 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 62 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 63 | 63 |
if err != nil {
|
| 64 | 64 |
t.Fatalf("couldn't copy from garbage path: %s:%s %s", cleanedContainerID, path, err)
|
| 65 | 65 |
} |
| ... | ... |
@@ -85,7 +85,7 @@ func TestCpGarbagePath(t *testing.T) {
|
| 85 | 85 |
|
| 86 | 86 |
// Check that relative paths are relative to the container's rootfs |
| 87 | 87 |
func TestCpRelativePath(t *testing.T) {
|
| 88 |
- out, exitCode, err := cmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 88 |
+ out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 89 | 89 |
if err != nil || exitCode != 0 {
|
| 90 | 90 |
t.Fatal("failed to create a container", out, err)
|
| 91 | 91 |
} |
| ... | ... |
@@ -93,7 +93,7 @@ func TestCpRelativePath(t *testing.T) {
|
| 93 | 93 |
cleanedContainerID := stripTrailingCharacters(out) |
| 94 | 94 |
defer deleteContainer(cleanedContainerID) |
| 95 | 95 |
|
| 96 |
- out, _, err = cmd(t, "wait", cleanedContainerID) |
|
| 96 |
+ out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 97 | 97 |
if err != nil || stripTrailingCharacters(out) != "0" {
|
| 98 | 98 |
t.Fatal("failed to set up container", out, err)
|
| 99 | 99 |
} |
| ... | ... |
@@ -122,7 +122,7 @@ func TestCpRelativePath(t *testing.T) {
|
| 122 | 122 |
|
| 123 | 123 |
path, _ := filepath.Rel("/", cpFullPath)
|
| 124 | 124 |
|
| 125 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 125 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 126 | 126 |
if err != nil {
|
| 127 | 127 |
t.Fatalf("couldn't copy from relative path: %s:%s %s", cleanedContainerID, path, err)
|
| 128 | 128 |
} |
| ... | ... |
@@ -148,7 +148,7 @@ func TestCpRelativePath(t *testing.T) {
|
| 148 | 148 |
|
| 149 | 149 |
// Check that absolute paths are relative to the container's rootfs |
| 150 | 150 |
func TestCpAbsolutePath(t *testing.T) {
|
| 151 |
- out, exitCode, err := cmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 151 |
+ out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath) |
|
| 152 | 152 |
if err != nil || exitCode != 0 {
|
| 153 | 153 |
t.Fatal("failed to create a container", out, err)
|
| 154 | 154 |
} |
| ... | ... |
@@ -156,7 +156,7 @@ func TestCpAbsolutePath(t *testing.T) {
|
| 156 | 156 |
cleanedContainerID := stripTrailingCharacters(out) |
| 157 | 157 |
defer deleteContainer(cleanedContainerID) |
| 158 | 158 |
|
| 159 |
- out, _, err = cmd(t, "wait", cleanedContainerID) |
|
| 159 |
+ out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 160 | 160 |
if err != nil || stripTrailingCharacters(out) != "0" {
|
| 161 | 161 |
t.Fatal("failed to set up container", out, err)
|
| 162 | 162 |
} |
| ... | ... |
@@ -185,7 +185,7 @@ func TestCpAbsolutePath(t *testing.T) {
|
| 185 | 185 |
|
| 186 | 186 |
path := cpFullPath |
| 187 | 187 |
|
| 188 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 188 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 189 | 189 |
if err != nil {
|
| 190 | 190 |
t.Fatalf("couldn't copy from absolute path: %s:%s %s", cleanedContainerID, path, err)
|
| 191 | 191 |
} |
| ... | ... |
@@ -212,7 +212,7 @@ func TestCpAbsolutePath(t *testing.T) {
|
| 212 | 212 |
// Test for #5619 |
| 213 | 213 |
// Check that absolute symlinks are still relative to the container's rootfs |
| 214 | 214 |
func TestCpAbsoluteSymlink(t *testing.T) {
|
| 215 |
- out, exitCode, err := cmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path") |
|
| 215 |
+ out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path") |
|
| 216 | 216 |
if err != nil || exitCode != 0 {
|
| 217 | 217 |
t.Fatal("failed to create a container", out, err)
|
| 218 | 218 |
} |
| ... | ... |
@@ -220,7 +220,7 @@ func TestCpAbsoluteSymlink(t *testing.T) {
|
| 220 | 220 |
cleanedContainerID := stripTrailingCharacters(out) |
| 221 | 221 |
defer deleteContainer(cleanedContainerID) |
| 222 | 222 |
|
| 223 |
- out, _, err = cmd(t, "wait", cleanedContainerID) |
|
| 223 |
+ out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 224 | 224 |
if err != nil || stripTrailingCharacters(out) != "0" {
|
| 225 | 225 |
t.Fatal("failed to set up container", out, err)
|
| 226 | 226 |
} |
| ... | ... |
@@ -249,7 +249,7 @@ func TestCpAbsoluteSymlink(t *testing.T) {
|
| 249 | 249 |
|
| 250 | 250 |
path := filepath.Join("/", "container_path")
|
| 251 | 251 |
|
| 252 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 252 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 253 | 253 |
if err != nil {
|
| 254 | 254 |
t.Fatalf("couldn't copy from absolute path: %s:%s %s", cleanedContainerID, path, err)
|
| 255 | 255 |
} |
| ... | ... |
@@ -276,7 +276,7 @@ func TestCpAbsoluteSymlink(t *testing.T) {
|
| 276 | 276 |
// Test for #5619 |
| 277 | 277 |
// Check that symlinks which are part of the resource path are still relative to the container's rootfs |
| 278 | 278 |
func TestCpSymlinkComponent(t *testing.T) {
|
| 279 |
- out, exitCode, err := cmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path") |
|
| 279 |
+ out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path") |
|
| 280 | 280 |
if err != nil || exitCode != 0 {
|
| 281 | 281 |
t.Fatal("failed to create a container", out, err)
|
| 282 | 282 |
} |
| ... | ... |
@@ -284,7 +284,7 @@ func TestCpSymlinkComponent(t *testing.T) {
|
| 284 | 284 |
cleanedContainerID := stripTrailingCharacters(out) |
| 285 | 285 |
defer deleteContainer(cleanedContainerID) |
| 286 | 286 |
|
| 287 |
- out, _, err = cmd(t, "wait", cleanedContainerID) |
|
| 287 |
+ out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 288 | 288 |
if err != nil || stripTrailingCharacters(out) != "0" {
|
| 289 | 289 |
t.Fatal("failed to set up container", out, err)
|
| 290 | 290 |
} |
| ... | ... |
@@ -313,7 +313,7 @@ func TestCpSymlinkComponent(t *testing.T) {
|
| 313 | 313 |
|
| 314 | 314 |
path := filepath.Join("/", "container_path", cpTestName)
|
| 315 | 315 |
|
| 316 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 316 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":"+path, tmpdir) |
|
| 317 | 317 |
if err != nil {
|
| 318 | 318 |
t.Fatalf("couldn't copy from symlink path component: %s:%s %s", cleanedContainerID, path, err)
|
| 319 | 319 |
} |
| ... | ... |
@@ -339,7 +339,7 @@ func TestCpSymlinkComponent(t *testing.T) {
|
| 339 | 339 |
|
| 340 | 340 |
// Check that cp with unprivileged user doesn't return any error |
| 341 | 341 |
func TestCpUnprivilegedUser(t *testing.T) {
|
| 342 |
- out, exitCode, err := cmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName) |
|
| 342 |
+ out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName) |
|
| 343 | 343 |
if err != nil || exitCode != 0 {
|
| 344 | 344 |
t.Fatal("failed to create a container", out, err)
|
| 345 | 345 |
} |
| ... | ... |
@@ -347,7 +347,7 @@ func TestCpUnprivilegedUser(t *testing.T) {
|
| 347 | 347 |
cleanedContainerID := stripTrailingCharacters(out) |
| 348 | 348 |
defer deleteContainer(cleanedContainerID) |
| 349 | 349 |
|
| 350 |
- out, _, err = cmd(t, "wait", cleanedContainerID) |
|
| 350 |
+ out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 351 | 351 |
if err != nil || stripTrailingCharacters(out) != "0" {
|
| 352 | 352 |
t.Fatal("failed to set up container", out, err)
|
| 353 | 353 |
} |
| ... | ... |
@@ -389,7 +389,7 @@ func TestCpVolumePath(t *testing.T) {
|
| 389 | 389 |
t.Fatal(err) |
| 390 | 390 |
} |
| 391 | 391 |
|
| 392 |
- out, exitCode, err := cmd(t, "run", "-d", "-v", "/foo", "-v", tmpDir+"/test:/test", "-v", tmpDir+":/baz", "busybox", "/bin/sh", "-c", "touch /foo/bar") |
|
| 392 |
+ out, exitCode, err := dockerCmd(t, "run", "-d", "-v", "/foo", "-v", tmpDir+"/test:/test", "-v", tmpDir+":/baz", "busybox", "/bin/sh", "-c", "touch /foo/bar") |
|
| 393 | 393 |
if err != nil || exitCode != 0 {
|
| 394 | 394 |
t.Fatal("failed to create a container", out, err)
|
| 395 | 395 |
} |
| ... | ... |
@@ -397,13 +397,13 @@ func TestCpVolumePath(t *testing.T) {
|
| 397 | 397 |
cleanedContainerID := stripTrailingCharacters(out) |
| 398 | 398 |
defer deleteContainer(cleanedContainerID) |
| 399 | 399 |
|
| 400 |
- out, _, err = cmd(t, "wait", cleanedContainerID) |
|
| 400 |
+ out, _, err = dockerCmd(t, "wait", cleanedContainerID) |
|
| 401 | 401 |
if err != nil || stripTrailingCharacters(out) != "0" {
|
| 402 | 402 |
t.Fatal("failed to set up container", out, err)
|
| 403 | 403 |
} |
| 404 | 404 |
|
| 405 | 405 |
// Copy actual volume path |
| 406 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":/foo", outDir) |
|
| 406 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/foo", outDir) |
|
| 407 | 407 |
if err != nil {
|
| 408 | 408 |
t.Fatalf("couldn't copy from volume path: %s:%s %v", cleanedContainerID, "/foo", err)
|
| 409 | 409 |
} |
| ... | ... |
@@ -423,7 +423,7 @@ func TestCpVolumePath(t *testing.T) {
|
| 423 | 423 |
} |
| 424 | 424 |
|
| 425 | 425 |
// Copy file nested in volume |
| 426 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":/foo/bar", outDir) |
|
| 426 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/foo/bar", outDir) |
|
| 427 | 427 |
if err != nil {
|
| 428 | 428 |
t.Fatalf("couldn't copy from volume path: %s:%s %v", cleanedContainerID, "/foo", err)
|
| 429 | 429 |
} |
| ... | ... |
@@ -436,7 +436,7 @@ func TestCpVolumePath(t *testing.T) {
|
| 436 | 436 |
} |
| 437 | 437 |
|
| 438 | 438 |
// Copy Bind-mounted dir |
| 439 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":/baz", outDir) |
|
| 439 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/baz", outDir) |
|
| 440 | 440 |
if err != nil {
|
| 441 | 441 |
t.Fatalf("couldn't copy from bind-mounted volume path: %s:%s %v", cleanedContainerID, "/baz", err)
|
| 442 | 442 |
} |
| ... | ... |
@@ -449,7 +449,7 @@ func TestCpVolumePath(t *testing.T) {
|
| 449 | 449 |
} |
| 450 | 450 |
|
| 451 | 451 |
// Copy file nested in bind-mounted dir |
| 452 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":/baz/test", outDir) |
|
| 452 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/baz/test", outDir) |
|
| 453 | 453 |
fb, err := ioutil.ReadFile(outDir + "/baz/test") |
| 454 | 454 |
if err != nil {
|
| 455 | 455 |
t.Fatal(err) |
| ... | ... |
@@ -463,7 +463,7 @@ func TestCpVolumePath(t *testing.T) {
|
| 463 | 463 |
} |
| 464 | 464 |
|
| 465 | 465 |
// Copy bind-mounted file |
| 466 |
- _, _, err = cmd(t, "cp", cleanedContainerID+":/test", outDir) |
|
| 466 |
+ _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/test", outDir) |
|
| 467 | 467 |
fb, err = ioutil.ReadFile(outDir + "/test") |
| 468 | 468 |
if err != nil {
|
| 469 | 469 |
t.Fatal(err) |
| ... | ... |
@@ -16,12 +16,12 @@ import ( |
| 16 | 16 |
) |
| 17 | 17 |
|
| 18 | 18 |
func TestEventsUntag(t *testing.T) {
|
| 19 |
- out, _, _ := cmd(t, "images", "-q") |
|
| 19 |
+ out, _, _ := dockerCmd(t, "images", "-q") |
|
| 20 | 20 |
image := strings.Split(out, "\n")[0] |
| 21 |
- cmd(t, "tag", image, "utest:tag1") |
|
| 22 |
- cmd(t, "tag", image, "utest:tag2") |
|
| 23 |
- cmd(t, "rmi", "utest:tag1") |
|
| 24 |
- cmd(t, "rmi", "utest:tag2") |
|
| 21 |
+ dockerCmd(t, "tag", image, "utest:tag1") |
|
| 22 |
+ dockerCmd(t, "tag", image, "utest:tag2") |
|
| 23 |
+ dockerCmd(t, "rmi", "utest:tag1") |
|
| 24 |
+ dockerCmd(t, "rmi", "utest:tag2") |
|
| 25 | 25 |
eventsCmd := exec.Command("timeout", "0.2", dockerBinary, "events", "--since=1")
|
| 26 | 26 |
out, _, _ = runCommandWithOutput(eventsCmd) |
| 27 | 27 |
events := strings.Split(out, "\n") |
| ... | ... |
@@ -39,11 +39,11 @@ func TestEventsUntag(t *testing.T) {
|
| 39 | 39 |
|
| 40 | 40 |
func TestEventsPause(t *testing.T) {
|
| 41 | 41 |
name := "testeventpause" |
| 42 |
- out, _, _ := cmd(t, "images", "-q") |
|
| 42 |
+ out, _, _ := dockerCmd(t, "images", "-q") |
|
| 43 | 43 |
image := strings.Split(out, "\n")[0] |
| 44 |
- cmd(t, "run", "-d", "--name", name, image, "sleep", "2") |
|
| 45 |
- cmd(t, "pause", name) |
|
| 46 |
- cmd(t, "unpause", name) |
|
| 44 |
+ dockerCmd(t, "run", "-d", "--name", name, image, "sleep", "2") |
|
| 45 |
+ dockerCmd(t, "pause", name) |
|
| 46 |
+ dockerCmd(t, "unpause", name) |
|
| 47 | 47 |
|
| 48 | 48 |
defer deleteAllContainers() |
| 49 | 49 |
|
| ... | ... |
@@ -75,7 +75,7 @@ func TestEventsPause(t *testing.T) {
|
| 75 | 75 |
func TestEventsContainerFailStartDie(t *testing.T) {
|
| 76 | 76 |
defer deleteAllContainers() |
| 77 | 77 |
|
| 78 |
- out, _, _ := cmd(t, "images", "-q") |
|
| 78 |
+ out, _, _ := dockerCmd(t, "images", "-q") |
|
| 79 | 79 |
image := strings.Split(out, "\n")[0] |
| 80 | 80 |
eventsCmd := exec.Command(dockerBinary, "run", "-d", "--name", "testeventdie", image, "blerg") |
| 81 | 81 |
_, _, err := runCommandWithOutput(eventsCmd) |
| ... | ... |
@@ -106,7 +106,7 @@ func TestEventsContainerFailStartDie(t *testing.T) {
|
| 106 | 106 |
func TestEventsLimit(t *testing.T) {
|
| 107 | 107 |
defer deleteAllContainers() |
| 108 | 108 |
for i := 0; i < 30; i++ {
|
| 109 |
- cmd(t, "run", "busybox", "echo", strconv.Itoa(i)) |
|
| 109 |
+ dockerCmd(t, "run", "busybox", "echo", strconv.Itoa(i)) |
|
| 110 | 110 |
} |
| 111 | 111 |
eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
|
| 112 | 112 |
out, _, _ := runCommandWithOutput(eventsCmd) |
| ... | ... |
@@ -119,7 +119,7 @@ func TestEventsLimit(t *testing.T) {
|
| 119 | 119 |
} |
| 120 | 120 |
|
| 121 | 121 |
func TestEventsContainerEvents(t *testing.T) {
|
| 122 |
- cmd(t, "run", "--rm", "busybox", "true") |
|
| 122 |
+ dockerCmd(t, "run", "--rm", "busybox", "true") |
|
| 123 | 123 |
eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
|
| 124 | 124 |
out, exitCode, err := runCommandWithOutput(eventsCmd) |
| 125 | 125 |
if exitCode != 0 || err != nil {
|
| ... | ... |
@@ -190,7 +190,7 @@ func TestEventsRedirectStdout(t *testing.T) {
|
| 190 | 190 |
|
| 191 | 191 |
since := time.Now().Unix() |
| 192 | 192 |
|
| 193 |
- cmd(t, "run", "busybox", "true") |
|
| 193 |
+ dockerCmd(t, "run", "busybox", "true") |
|
| 194 | 194 |
|
| 195 | 195 |
defer deleteAllContainers() |
| 196 | 196 |
|
| ... | ... |
@@ -62,21 +62,21 @@ func TestLinksPingUnlinkedContainers(t *testing.T) {
|
| 62 | 62 |
|
| 63 | 63 |
func TestLinksPingLinkedContainers(t *testing.T) {
|
| 64 | 64 |
var out string |
| 65 |
- out, _, _ = cmd(t, "run", "-d", "--name", "container1", "busybox", "sleep", "10") |
|
| 65 |
+ out, _, _ = dockerCmd(t, "run", "-d", "--name", "container1", "busybox", "sleep", "10") |
|
| 66 | 66 |
idA := stripTrailingCharacters(out) |
| 67 |
- out, _, _ = cmd(t, "run", "-d", "--name", "container2", "busybox", "sleep", "10") |
|
| 67 |
+ out, _, _ = dockerCmd(t, "run", "-d", "--name", "container2", "busybox", "sleep", "10") |
|
| 68 | 68 |
idB := stripTrailingCharacters(out) |
| 69 |
- cmd(t, "run", "--rm", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1") |
|
| 70 |
- cmd(t, "kill", idA) |
|
| 71 |
- cmd(t, "kill", idB) |
|
| 69 |
+ dockerCmd(t, "run", "--rm", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1") |
|
| 70 |
+ dockerCmd(t, "kill", idA) |
|
| 71 |
+ dockerCmd(t, "kill", idB) |
|
| 72 | 72 |
deleteAllContainers() |
| 73 | 73 |
|
| 74 | 74 |
logDone("links - ping linked container")
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
func TestLinksIpTablesRulesWhenLinkAndUnlink(t *testing.T) {
|
| 78 |
- cmd(t, "run", "-d", "--name", "child", "--publish", "8080:80", "busybox", "sleep", "10") |
|
| 79 |
- cmd(t, "run", "-d", "--name", "parent", "--link", "child:http", "busybox", "sleep", "10") |
|
| 78 |
+ dockerCmd(t, "run", "-d", "--name", "child", "--publish", "8080:80", "busybox", "sleep", "10") |
|
| 79 |
+ dockerCmd(t, "run", "-d", "--name", "parent", "--link", "child:http", "busybox", "sleep", "10") |
|
| 80 | 80 |
|
| 81 | 81 |
childIP := findContainerIP(t, "child") |
| 82 | 82 |
parentIP := findContainerIP(t, "parent") |
| ... | ... |
@@ -87,13 +87,13 @@ func TestLinksIpTablesRulesWhenLinkAndUnlink(t *testing.T) {
|
| 87 | 87 |
t.Fatal("Iptables rules not found")
|
| 88 | 88 |
} |
| 89 | 89 |
|
| 90 |
- cmd(t, "rm", "--link", "parent/http") |
|
| 90 |
+ dockerCmd(t, "rm", "--link", "parent/http") |
|
| 91 | 91 |
if iptables.Exists(sourceRule...) || iptables.Exists(destinationRule...) {
|
| 92 | 92 |
t.Fatal("Iptables rules should be removed when unlink")
|
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 |
- cmd(t, "kill", "child") |
|
| 96 |
- cmd(t, "kill", "parent") |
|
| 95 |
+ dockerCmd(t, "kill", "child") |
|
| 96 |
+ dockerCmd(t, "kill", "parent") |
|
| 97 | 97 |
deleteAllContainers() |
| 98 | 98 |
|
| 99 | 99 |
logDone("link - verify iptables when link and unlink")
|
| ... | ... |
@@ -105,9 +105,9 @@ func TestLinksInspectLinksStarted(t *testing.T) {
|
| 105 | 105 |
result []string |
| 106 | 106 |
) |
| 107 | 107 |
defer deleteAllContainers() |
| 108 |
- cmd(t, "run", "-d", "--name", "container1", "busybox", "sleep", "10") |
|
| 109 |
- cmd(t, "run", "-d", "--name", "container2", "busybox", "sleep", "10") |
|
| 110 |
- cmd(t, "run", "-d", "--name", "testinspectlink", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "sleep", "10") |
|
| 108 |
+ dockerCmd(t, "run", "-d", "--name", "container1", "busybox", "sleep", "10") |
|
| 109 |
+ dockerCmd(t, "run", "-d", "--name", "container2", "busybox", "sleep", "10") |
|
| 110 |
+ dockerCmd(t, "run", "-d", "--name", "testinspectlink", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "sleep", "10") |
|
| 111 | 111 |
links, err := inspectFieldJSON("testinspectlink", "HostConfig.Links")
|
| 112 | 112 |
if err != nil {
|
| 113 | 113 |
t.Fatal(err) |
| ... | ... |
@@ -134,9 +134,9 @@ func TestLinksInspectLinksStopped(t *testing.T) {
|
| 134 | 134 |
result []string |
| 135 | 135 |
) |
| 136 | 136 |
defer deleteAllContainers() |
| 137 |
- cmd(t, "run", "-d", "--name", "container1", "busybox", "sleep", "10") |
|
| 138 |
- cmd(t, "run", "-d", "--name", "container2", "busybox", "sleep", "10") |
|
| 139 |
- cmd(t, "run", "-d", "--name", "testinspectlink", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "true") |
|
| 137 |
+ dockerCmd(t, "run", "-d", "--name", "container1", "busybox", "sleep", "10") |
|
| 138 |
+ dockerCmd(t, "run", "-d", "--name", "container2", "busybox", "sleep", "10") |
|
| 139 |
+ dockerCmd(t, "run", "-d", "--name", "testinspectlink", "--link", "container1:alias1", "--link", "container2:alias2", "busybox", "true") |
|
| 140 | 140 |
links, err := inspectFieldJSON("testinspectlink", "HostConfig.Links")
|
| 141 | 141 |
if err != nil {
|
| 142 | 142 |
t.Fatal(err) |
| ... | ... |
@@ -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, _, _ := cmd(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,35 +40,35 @@ func TestRmiWithContainerFails(t *testing.T) {
|
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 | 42 |
func TestRmiTag(t *testing.T) {
|
| 43 |
- imagesBefore, _, _ := cmd(t, "images", "-a") |
|
| 44 |
- cmd(t, "tag", "busybox", "utest:tag1") |
|
| 45 |
- cmd(t, "tag", "busybox", "utest/docker:tag2") |
|
| 46 |
- cmd(t, "tag", "busybox", "utest:5000/docker:tag3") |
|
| 43 |
+ imagesBefore, _, _ := dockerCmd(t, "images", "-a") |
|
| 44 |
+ dockerCmd(t, "tag", "busybox", "utest:tag1") |
|
| 45 |
+ dockerCmd(t, "tag", "busybox", "utest/docker:tag2") |
|
| 46 |
+ dockerCmd(t, "tag", "busybox", "utest:5000/docker:tag3") |
|
| 47 | 47 |
{
|
| 48 |
- imagesAfter, _, _ := cmd(t, "images", "-a") |
|
| 48 |
+ imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 49 | 49 |
if nLines(imagesAfter) != nLines(imagesBefore)+3 {
|
| 50 | 50 |
t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
|
| 51 | 51 |
} |
| 52 | 52 |
} |
| 53 |
- cmd(t, "rmi", "utest/docker:tag2") |
|
| 53 |
+ dockerCmd(t, "rmi", "utest/docker:tag2") |
|
| 54 | 54 |
{
|
| 55 |
- imagesAfter, _, _ := cmd(t, "images", "-a") |
|
| 55 |
+ imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 56 | 56 |
if nLines(imagesAfter) != nLines(imagesBefore)+2 {
|
| 57 | 57 |
t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
|
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 | 60 |
} |
| 61 |
- cmd(t, "rmi", "utest:5000/docker:tag3") |
|
| 61 |
+ dockerCmd(t, "rmi", "utest:5000/docker:tag3") |
|
| 62 | 62 |
{
|
| 63 |
- imagesAfter, _, _ := cmd(t, "images", "-a") |
|
| 63 |
+ imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 64 | 64 |
if nLines(imagesAfter) != nLines(imagesBefore)+1 {
|
| 65 | 65 |
t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
} |
| 69 |
- cmd(t, "rmi", "utest:tag1") |
|
| 69 |
+ dockerCmd(t, "rmi", "utest:tag1") |
|
| 70 | 70 |
{
|
| 71 |
- imagesAfter, _, _ := cmd(t, "images", "-a") |
|
| 71 |
+ imagesAfter, _, _ := dockerCmd(t, "images", "-a") |
|
| 72 | 72 |
if nLines(imagesAfter) != nLines(imagesBefore)+0 {
|
| 73 | 73 |
t.Fatalf("before: %q\n\nafter: %q\n", imagesBefore, imagesAfter)
|
| 74 | 74 |
} |
| ... | ... |
@@ -798,7 +798,7 @@ func TestRunLoopbackWhenNetworkDisabled(t *testing.T) {
|
| 798 | 798 |
} |
| 799 | 799 |
|
| 800 | 800 |
func TestRunNetHostNotAllowedWithLinks(t *testing.T) {
|
| 801 |
- _, _, err := cmd(t, "run", "--name", "linked", "busybox", "true") |
|
| 801 |
+ _, _, err := dockerCmd(t, "run", "--name", "linked", "busybox", "true") |
|
| 802 | 802 |
|
| 803 | 803 |
cmd := exec.Command(dockerBinary, "run", "--net=host", "--link", "linked:linked", "busybox", "true") |
| 804 | 804 |
_, _, err = runCommandWithOutput(cmd) |
| ... | ... |
@@ -1204,7 +1204,7 @@ func TestRunModeHostname(t *testing.T) {
|
| 1204 | 1204 |
} |
| 1205 | 1205 |
|
| 1206 | 1206 |
func TestRunRootWorkdir(t *testing.T) {
|
| 1207 |
- s, _, err := cmd(t, "run", "--workdir", "/", "busybox", "pwd") |
|
| 1207 |
+ s, _, err := dockerCmd(t, "run", "--workdir", "/", "busybox", "pwd") |
|
| 1208 | 1208 |
if err != nil {
|
| 1209 | 1209 |
t.Fatal(s, err) |
| 1210 | 1210 |
} |
| ... | ... |
@@ -1218,7 +1218,7 @@ func TestRunRootWorkdir(t *testing.T) {
|
| 1218 | 1218 |
} |
| 1219 | 1219 |
|
| 1220 | 1220 |
func TestRunAllowBindMountingRoot(t *testing.T) {
|
| 1221 |
- s, _, err := cmd(t, "run", "-v", "/:/host", "busybox", "ls", "/host") |
|
| 1221 |
+ s, _, err := dockerCmd(t, "run", "-v", "/:/host", "busybox", "ls", "/host") |
|
| 1222 | 1222 |
if err != nil {
|
| 1223 | 1223 |
t.Fatal(s, err) |
| 1224 | 1224 |
} |
| ... | ... |
@@ -12,8 +12,8 @@ import ( |
| 12 | 12 |
func TestStartAttachReturnsOnError(t *testing.T) {
|
| 13 | 13 |
defer deleteAllContainers() |
| 14 | 14 |
|
| 15 |
- cmd(t, "run", "-d", "--name", "test", "busybox") |
|
| 16 |
- cmd(t, "stop", "test") |
|
| 15 |
+ dockerCmd(t, "run", "-d", "--name", "test", "busybox") |
|
| 16 |
+ dockerCmd(t, "stop", "test") |
|
| 17 | 17 |
|
| 18 | 18 |
// Expect this to fail because the above container is stopped, this is what we want |
| 19 | 19 |
if _, err := runCommand(exec.Command(dockerBinary, "run", "-d", "--name", "test2", "--link", "test:test", "busybox")); err == nil {
|
| ... | ... |
@@ -73,7 +73,7 @@ func TestStartRecordError(t *testing.T) {
|
| 73 | 73 |
defer deleteAllContainers() |
| 74 | 74 |
|
| 75 | 75 |
// when container runs successfully, we should not have state.Error |
| 76 |
- cmd(t, "run", "-d", "-p", "9999:9999", "--name", "test", "busybox", "top") |
|
| 76 |
+ dockerCmd(t, "run", "-d", "-p", "9999:9999", "--name", "test", "busybox", "top") |
|
| 77 | 77 |
stateErr, err := inspectField("test", "State.Error")
|
| 78 | 78 |
if err != nil {
|
| 79 | 79 |
t.Fatalf("Failed to inspect %q state's error, got error %q", "test", err)
|
| ... | ... |
@@ -97,8 +97,8 @@ func TestStartRecordError(t *testing.T) {
|
| 97 | 97 |
} |
| 98 | 98 |
|
| 99 | 99 |
// Expect the conflict to be resolved when we stop the initial container |
| 100 |
- cmd(t, "stop", "test") |
|
| 101 |
- cmd(t, "start", "test2") |
|
| 100 |
+ dockerCmd(t, "stop", "test") |
|
| 101 |
+ dockerCmd(t, "start", "test2") |
|
| 102 | 102 |
stateErr, err = inspectField("test2", "State.Error")
|
| 103 | 103 |
if err != nil {
|
| 104 | 104 |
t.Fatalf("Failed to inspect %q state's error, got error %q", "test", err)
|
| ... | ... |
@@ -115,7 +115,7 @@ func TestStartVolumesFromFailsCleanly(t *testing.T) {
|
| 115 | 115 |
defer deleteAllContainers() |
| 116 | 116 |
|
| 117 | 117 |
// Create the first data volume |
| 118 |
- cmd(t, "run", "-d", "--name", "data_before", "-v", "/foo", "busybox") |
|
| 118 |
+ dockerCmd(t, "run", "-d", "--name", "data_before", "-v", "/foo", "busybox") |
|
| 119 | 119 |
|
| 120 | 120 |
// Expect this to fail because the data test after contaienr doesn't exist yet |
| 121 | 121 |
if _, err := runCommand(exec.Command(dockerBinary, "run", "-d", "--name", "consumer", "--volumes-from", "data_before", "--volumes-from", "data_after", "busybox")); err == nil {
|
| ... | ... |
@@ -123,13 +123,13 @@ func TestStartVolumesFromFailsCleanly(t *testing.T) {
|
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 | 125 |
// Create the second data volume |
| 126 |
- cmd(t, "run", "-d", "--name", "data_after", "-v", "/bar", "busybox") |
|
| 126 |
+ dockerCmd(t, "run", "-d", "--name", "data_after", "-v", "/bar", "busybox") |
|
| 127 | 127 |
|
| 128 | 128 |
// Now, all the volumes should be there |
| 129 |
- cmd(t, "start", "consumer") |
|
| 129 |
+ dockerCmd(t, "start", "consumer") |
|
| 130 | 130 |
|
| 131 | 131 |
// Check that we have the volumes we want |
| 132 |
- out, _, _ := cmd(t, "inspect", "--format='{{ len .Volumes }}'", "consumer")
|
|
| 132 |
+ out, _, _ := dockerCmd(t, "inspect", "--format='{{ len .Volumes }}'", "consumer")
|
|
| 133 | 133 |
n_volumes := strings.Trim(out, " \r\n'") |
| 134 | 134 |
if n_volumes != "2" {
|
| 135 | 135 |
t.Fatalf("Missing volumes: expected 2, got %s", n_volumes)
|
| ... | ... |
@@ -356,11 +356,6 @@ func pullImageIfNotExist(image string) (err error) {
|
| 356 | 356 |
return |
| 357 | 357 |
} |
| 358 | 358 |
|
| 359 |
-// deprecated, use dockerCmd instead |
|
| 360 |
-func cmd(t *testing.T, args ...string) (string, int, error) {
|
|
| 361 |
- return dockerCmd(t, args...) |
|
| 362 |
-} |
|
| 363 |
- |
|
| 364 | 359 |
func dockerCmd(t *testing.T, args ...string) (string, int, error) {
|
| 365 | 360 |
out, status, err := runCommandWithOutput(exec.Command(dockerBinary, args...)) |
| 366 | 361 |
if err != nil {
|