Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
| ... | ... |
@@ -484,6 +484,36 @@ func TestVolumeWithSymlink(t *testing.T) {
|
| 484 | 484 |
logDone("run - volume with symlink")
|
| 485 | 485 |
} |
| 486 | 486 |
|
| 487 |
+// Tests that a volume path that has a symlink exists in a container mounting it with `--volumes-from`. |
|
| 488 |
+func TestVolumesFromSymlinkPath(t *testing.T) {
|
|
| 489 |
+ buildCmd := exec.Command(dockerBinary, "build", "-t", "docker-test-volumesfromsymlinkpath", "-") |
|
| 490 |
+ buildCmd.Stdin = strings.NewReader(`FROM busybox |
|
| 491 |
+ RUN mkdir /baz && ln -s /baz /foo |
|
| 492 |
+ VOLUME ["/foo/bar"]`) |
|
| 493 |
+ buildCmd.Dir = workingDirectory |
|
| 494 |
+ err := buildCmd.Run() |
|
| 495 |
+ if err != nil {
|
|
| 496 |
+ t.Fatalf("could not build 'docker-test-volumesfromsymlinkpath': %v", err)
|
|
| 497 |
+ } |
|
| 498 |
+ |
|
| 499 |
+ cmd := exec.Command(dockerBinary, "run", "--name", "test-volumesfromsymlinkpath", "docker-test-volumesfromsymlinkpath") |
|
| 500 |
+ exitCode, err := runCommand(cmd) |
|
| 501 |
+ if err != nil || exitCode != 0 {
|
|
| 502 |
+ t.Fatalf("[run] (volume) err: %v, exitcode: %d", err, exitCode)
|
|
| 503 |
+ } |
|
| 504 |
+ |
|
| 505 |
+ cmd = exec.Command(dockerBinary, "run", "--volumes-from", "test-volumesfromsymlinkpath", "busybox", "sh", "-c", "ls /foo | grep -q bar") |
|
| 506 |
+ exitCode, err = runCommand(cmd) |
|
| 507 |
+ if err != nil || exitCode != 0 {
|
|
| 508 |
+ t.Fatalf("[run] err: %v, exitcode: %d", err, exitCode)
|
|
| 509 |
+ } |
|
| 510 |
+ |
|
| 511 |
+ deleteImages("docker-test-volumesfromsymlinkpath")
|
|
| 512 |
+ deleteAllContainers() |
|
| 513 |
+ |
|
| 514 |
+ logDone("run - volumes-from symlink path")
|
|
| 515 |
+} |
|
| 516 |
+ |
|
| 487 | 517 |
func TestExitCode(t *testing.T) {
|
| 488 | 518 |
cmd := exec.Command(dockerBinary, "run", "busybox", "/bin/sh", "-c", "exit 72") |
| 489 | 519 |
|