Browse code

Tweak bind mount errors

These messages were enhanced to include the path that was
missing (in df6af282b9048dfedcd7b7a9a89126aca887f4e1), but
also changed the first part of the message.

This change complicates running e2e tests with mixed versions
of the engine.

Looking at the full error message, "mount" is a bit redundant
as well, because the error message already indicates this is
about a "mount";

docker run --rm --mount type=bind,source=/no-such-thing,target=/foo busybox
docker: Error response from daemon: invalid mount config for type "bind": bind mount source path does not exist: /no-such-thing.

Removing the "mount" part from the error message, because
it was redundant, and makes cross-version testing easier :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2018/09/28 19:09:52
Showing 3 changed files
... ...
@@ -1759,7 +1759,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsValidation(c *check.C) {
1759 1759
 					Target: destPath}}},
1760 1760
 			msg: "source path does not exist",
1761 1761
 			// FIXME(vdemeester) fails into e2e, migrate to integration/container anyway
1762
-			// msg: "bind mount source path does not exist: " + notExistPath,
1762
+			// msg: "source path does not exist: " + notExistPath,
1763 1763
 		},
1764 1764
 		{
1765 1765
 			config: containertypes.Config{
... ...
@@ -120,7 +120,7 @@ func TestParseMountRaw(t *testing.T) {
120 120
 			`c:\:d:\:xyzzy`:                    "invalid volume specification: ",
121 121
 			`c:`:                               "cannot be `c:`",
122 122
 			`c:\`:                              "cannot be `c:`",
123
-			`c:\notexist:d:`:                   `bind mount source path does not exist: c:\notexist`,
123
+			`c:\notexist:d:`:                   `source path does not exist: c:\notexist`,
124 124
 			`c:\windows\system32\ntdll.dll:d:`: `source path must be a directory`,
125 125
 			`name<:d:`:                         `invalid volume specification`,
126 126
 			`name>:d:`:                         `invalid volume specification`,
... ...
@@ -189,7 +189,7 @@ func TestParseMountRaw(t *testing.T) {
189 189
 			`c:\:/foo:xyzzy`:                     "invalid volume specification: ",
190 190
 			`/`:                                  "destination can't be '/'",
191 191
 			`/..`:                                "destination can't be '/'",
192
-			`c:\notexist:/foo`:                   `bind mount source path does not exist: c:\notexist`,
192
+			`c:\notexist:/foo`:                   `source path does not exist: c:\notexist`,
193 193
 			`c:\windows\system32\ntdll.dll:/foo`: `source path must be a directory`,
194 194
 			`name<:/foo`:                         `invalid volume specification`,
195 195
 			`name>:/foo`:                         `invalid volume specification`,
... ...
@@ -17,7 +17,7 @@ func (e *errMountConfig) Error() string {
17 17
 }
18 18
 
19 19
 func errBindSourceDoesNotExist(path string) error {
20
-	return errors.Errorf("bind mount source path does not exist: %s", path)
20
+	return errors.Errorf("bind source path does not exist: %s", path)
21 21
 }
22 22
 
23 23
 func errExtraField(name string) error {