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 <bgoff@cpuguy83-mbp.home> (github: cpuguy83)
| ... | ... |
@@ -235,7 +235,7 @@ func parseVolumesFromSpec(daemon *Daemon, spec string) (map[string]*Mount, error |
| 235 | 235 |
|
| 236 | 236 |
if len(specParts) == 2 {
|
| 237 | 237 |
mode := specParts[1] |
| 238 |
- if validMountMode(mode) {
|
|
| 238 |
+ if !validMountMode(mode) {
|
|
| 239 | 239 |
return nil, fmt.Errorf("Invalid mode for volumes-from: %s", mode)
|
| 240 | 240 |
} |
| 241 | 241 |
|
| ... | ... |
@@ -389,7 +389,7 @@ func TestRunVolumesFromInReadWriteMode(t *testing.T) {
|
| 389 | 389 |
t.Fatal(err) |
| 390 | 390 |
} |
| 391 | 391 |
|
| 392 |
- cmd = exec.Command(dockerBinary, "run", "--volumes-from", "parent", "busybox", "touch", "/test/file") |
|
| 392 |
+ cmd = exec.Command(dockerBinary, "run", "--volumes-from", "parent:rw", "busybox", "touch", "/test/file") |
|
| 393 | 393 |
if _, err := runCommand(cmd); err != nil {
|
| 394 | 394 |
t.Fatal(err) |
| 395 | 395 |
} |