Browse code

rename TestVolumeWithSymlink to TestCreateVolumeWithSymlink and remove run_tests folder

Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)

Tibor Vass authored on 2014/05/28 06:54:38
Showing 2 changed files
... ...
@@ -4,7 +4,6 @@ import (
4 4
 	"fmt"
5 5
 	"os"
6 6
 	"os/exec"
7
-	"path/filepath"
8 7
 	"reflect"
9 8
 	"regexp"
10 9
 	"sort"
... ...
@@ -444,29 +443,30 @@ func TestCreateVolume(t *testing.T) {
444 444
 
445 445
 // Test that creating a volume with a symlink in its path works correctly. Test for #5152.
446 446
 // Note that this bug happens only with symlinks with a target that starts with '/'.
447
-func TestVolumeWithSymlink(t *testing.T) {
448
-	buildDirectory := filepath.Join(workingDirectory, "run_tests", "TestVolumeWithSymlink")
449
-	buildCmd := exec.Command(dockerBinary, "build", "-t", "docker-test-volumewithsymlink", ".")
450
-	buildCmd.Dir = buildDirectory
447
+func TestCreateVolumeWithSymlink(t *testing.T) {
448
+	buildCmd := exec.Command(dockerBinary, "build", "-t", "docker-test-createvolumewithsymlink", "-")
449
+	buildCmd.Stdin = strings.NewReader(`FROM busybox
450
+		RUN mkdir /foo && ln -s /foo /bar`)
451
+	buildCmd.Dir = workingDirectory
451 452
 	err := buildCmd.Run()
452 453
 	if err != nil {
453
-		t.Fatalf("could not build 'docker-test-volumewithsymlink': %v", err)
454
+		t.Fatalf("could not build 'docker-test-createvolumewithsymlink': %v", err)
454 455
 	}
455 456
 
456
-	cmd := exec.Command(dockerBinary, "run", "-v", "/bar/foo", "--name", "test-volumewithsymlink", "docker-test-volumewithsymlink", "sh", "-c", "mount | grep -q /foo/foo")
457
+	cmd := exec.Command(dockerBinary, "run", "-v", "/bar/foo", "--name", "test-createvolumewithsymlink", "docker-test-createvolumewithsymlink", "sh", "-c", "mount | grep -q /foo/foo")
457 458
 	exitCode, err := runCommand(cmd)
458 459
 	if err != nil || exitCode != 0 {
459 460
 		t.Fatalf("[run] err: %v, exitcode: %d", err, exitCode)
460 461
 	}
461 462
 
462 463
 	var volPath string
463
-	cmd = exec.Command(dockerBinary, "inspect", "-f", "{{range .Volumes}}{{.}}{{end}}", "test-volumewithsymlink")
464
+	cmd = exec.Command(dockerBinary, "inspect", "-f", "{{range .Volumes}}{{.}}{{end}}", "test-createvolumewithsymlink")
464 465
 	volPath, exitCode, err = runCommandWithOutput(cmd)
465 466
 	if err != nil || exitCode != 0 {
466 467
 		t.Fatalf("[inspect] err: %v, exitcode: %d", err, exitCode)
467 468
 	}
468 469
 
469
-	cmd = exec.Command(dockerBinary, "rm", "-v", "test-volumewithsymlink")
470
+	cmd = exec.Command(dockerBinary, "rm", "-v", "test-createvolumewithsymlink")
470 471
 	exitCode, err = runCommand(cmd)
471 472
 	if err != nil || exitCode != 0 {
472 473
 		t.Fatalf("[rm] err: %v, exitcode: %d", err, exitCode)
... ...
@@ -478,10 +478,10 @@ func TestVolumeWithSymlink(t *testing.T) {
478 478
 		t.Fatalf("[open] (expecting 'file does not exist' error) err: %v, volPath: %s", err, volPath)
479 479
 	}
480 480
 
481
-	deleteImages("docker-test-volumewithsymlink")
481
+	deleteImages("docker-test-createvolumewithsymlink")
482 482
 	deleteAllContainers()
483 483
 
484
-	logDone("run - volume with symlink")
484
+	logDone("run - create volume with symlink")
485 485
 }
486 486
 
487 487
 // Tests that a volume path that has a symlink exists in a container mounting it with `--volumes-from`.
488 488
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-FROM busybox
2
-
3
-RUN mkdir /foo && ln -s /foo /bar