@@ -128,6 +128,21 @@ func TestMountOptErrors(t *testing.T) {
128128 value : "type=volume,src =/foo,target=/foo" ,
129129 expErr : "invalid option 'src' in 'src =/foo': option should not have whitespace" ,
130130 },
131+ {
132+ doc : "invalid value is empty" ,
133+ value : "type=volume,src=,target=/foo" ,
134+ expErr : "invalid value for 'src': value is empty" ,
135+ },
136+ {
137+ doc : "invalid value with leading whitespace" ,
138+ value : "type=volume,src= /foo,target=/foo" ,
139+ expErr : "invalid value for 'src' in 'src= /foo': value should not have whitespace" ,
140+ },
141+ {
142+ doc : "invalid value with trailing whitespace" ,
143+ value : "type=volume,src=/foo ,target=/foo" ,
144+ expErr : "invalid value for 'src' in 'src=/foo ': value should not have whitespace" ,
145+ },
131146 {
132147 doc : "missing value" ,
133148 value : "type=volume,target=/foo,bogus" ,
@@ -171,8 +186,8 @@ func TestMountOptReadOnly(t *testing.T) {
171186 }{
172187 {value : "" , exp : false },
173188 {value : "readonly" , exp : true },
174- {value : "readonly=" , expErr : `invalid value for readonly: ` },
175- {value : "readonly= true" , expErr : `invalid value for readonly: true` },
189+ {value : "readonly=" , expErr : `invalid value for ' readonly': value is empty ` },
190+ {value : "readonly= true" , expErr : `invalid value for ' readonly' in 'readonly= true': value should not have whitespace ` },
176191 {value : "readonly=no" , expErr : `invalid value for readonly: no` },
177192 {value : "readonly=1" , exp : true },
178193 {value : "readonly=true" , exp : true },
@@ -215,8 +230,8 @@ func TestMountOptVolumeNoCopy(t *testing.T) {
215230 }{
216231 {value : "" , exp : false },
217232 {value : "volume-nocopy" , exp : true },
218- {value : "volume-nocopy=" , expErr : `invalid value for volume-nocopy: ` },
219- {value : "volume-nocopy= true" , expErr : `invalid value for volume-nocopy: true` },
233+ {value : "volume-nocopy=" , expErr : `invalid value for ' volume-nocopy': value is empty ` },
234+ {value : "volume-nocopy= true" , expErr : `invalid value for ' volume-nocopy' in 'volume-nocopy= true': value should not have whitespace ` },
220235 {value : "volume-nocopy=no" , expErr : `invalid value for volume-nocopy: no` },
221236 {value : "volume-nocopy=1" , exp : true },
222237 {value : "volume-nocopy=true" , exp : true },
0 commit comments