Browse code

Support rw as a volume option in compose file.

Signed-off-by: Daniel Nephin <dnephin@docker.com>

Daniel Nephin authored on 2017/04/06 23:32:35
Showing 2 changed files
... ...
@@ -70,6 +70,8 @@ func populateFieldFromBuffer(char rune, buffer []rune, volume *types.ServiceVolu
70 70
 		switch option {
71 71
 		case "ro":
72 72
 			volume.ReadOnly = true
73
+		case "rw":
74
+			volume.ReadOnly = false
73 75
 		case "nocopy":
74 76
 			volume.Volume = &types.ServiceVolumeVolume{NoCopy: true}
75 77
 		default:
... ...
@@ -132,3 +132,17 @@ func TestParseVolumeWithReadOnly(t *testing.T) {
132 132
 		assert.DeepEqual(t, volume, expected)
133 133
 	}
134 134
 }
135
+
136
+func TestParseVolumeWithRW(t *testing.T) {
137
+	for _, path := range []string{"./foo", "/home/user"} {
138
+		volume, err := parseVolume(path + ":/target:rw")
139
+		expected := types.ServiceVolumeConfig{
140
+			Type:     "bind",
141
+			Source:   path,
142
+			Target:   "/target",
143
+			ReadOnly: false,
144
+		}
145
+		assert.NilError(t, err)
146
+		assert.DeepEqual(t, volume, expected)
147
+	}
148
+}