From 007b4f63409c6c642fb075640a8ec7d58825edc8 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Fri, 3 Oct 2014 16:55:39 -0400 Subject: [PATCH] Fixes bad validMountMode check Needed to check if the mode was invalid and return error, not valid and return error. This didn't get picked up because the existing integration-cli tests were all either expecting errors when a valid mode was passed in (e.g. "ro" passed in, we expected an error because it was testing write). So modified a test which was testing for "rw" to actually pass in "rw" instead of assuming the "rw" Docker-DCO-1.1-Signed-off-by: Brian Goff (github: cpuguy83) --- daemon/volumes.go | 2 +- integration-cli/docker_cli_run_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/volumes.go b/daemon/volumes.go index 3d6864b7d..867bbb44e 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -235,7 +235,7 @@ func parseVolumesFromSpec(daemon *Daemon, spec string) (map[string]*Mount, error if len(specParts) == 2 { mode := specParts[1] - if validMountMode(mode) { + if !validMountMode(mode) { return nil, fmt.Errorf("Invalid mode for volumes-from: %s", mode) } diff --git a/integration-cli/docker_cli_run_test.go b/integration-cli/docker_cli_run_test.go index 01a3f5763..e218430ce 100644 --- a/integration-cli/docker_cli_run_test.go +++ b/integration-cli/docker_cli_run_test.go @@ -389,7 +389,7 @@ func TestRunVolumesFromInReadWriteMode(t *testing.T) { t.Fatal(err) } - cmd = exec.Command(dockerBinary, "run", "--volumes-from", "parent", "busybox", "touch", "/test/file") + cmd = exec.Command(dockerBinary, "run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file") if _, err := runCommand(cmd); err != nil { t.Fatal(err) }