|
@@ -2396,3 +2396,53 @@ func TestRunNoOutputFromPullInStdout(t *testing.T) {
|
|
}
|
|
}
|
|
logDone("run - no output from pull in stdout")
|
|
logDone("run - no output from pull in stdout")
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func TestRunVolumesCleanPaths(t *testing.T) {
|
|
|
|
+ defer deleteAllContainers()
|
|
|
|
+
|
|
|
|
+ if _, err := buildImage("run_volumes_clean_paths",
|
|
|
|
+ `FROM busybox
|
|
|
|
+ VOLUME /foo/`,
|
|
|
|
+ true); err != nil {
|
|
|
|
+ t.Fatal(err)
|
|
|
|
+ }
|
|
|
|
+ defer deleteImages("run_volumes_clean_paths")
|
|
|
|
+
|
|
|
|
+ cmd := exec.Command(dockerBinary, "run", "-v", "/foo", "-v", "/bar/", "--name", "dark_helmet", "run_volumes_clean_paths")
|
|
|
|
+ if out, _, err := runCommandWithOutput(cmd); err != nil {
|
|
|
|
+ t.Fatal(err, out)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ out, err := inspectFieldMap("dark_helmet", "Volumes", "/foo/")
|
|
|
|
+ if err != nil {
|
|
|
|
+ t.Fatal(err)
|
|
|
|
+ }
|
|
|
|
+ if out != "<no value>" {
|
|
|
|
+ t.Fatalf("Found unexpected volume entry for '/foo/' in volumes\n%q", out)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ out, err = inspectFieldMap("dark_helmet", "Volumes", "/foo")
|
|
|
|
+ if err != nil {
|
|
|
|
+ t.Fatal(err)
|
|
|
|
+ }
|
|
|
|
+ if !strings.Contains(out, volumesStoragePath) {
|
|
|
|
+ t.Fatalf("Volume was not defined for /foo\n%q", out)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ out, err = inspectFieldMap("dark_helmet", "Volumes", "/bar/")
|
|
|
|
+ if err != nil {
|
|
|
|
+ t.Fatal(err)
|
|
|
|
+ }
|
|
|
|
+ if out != "<no value>" {
|
|
|
|
+ t.Fatalf("Found unexpected volume entry for '/bar/' in volumes\n%q", out)
|
|
|
|
+ }
|
|
|
|
+ out, err = inspectFieldMap("dark_helmet", "Volumes", "/bar")
|
|
|
|
+ if err != nil {
|
|
|
|
+ t.Fatal(err)
|
|
|
|
+ }
|
|
|
|
+ if !strings.Contains(out, volumesStoragePath) {
|
|
|
|
+ t.Fatalf("Volume was not defined for /bar\n%q", out)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ logDone("run - volume paths are cleaned")
|
|
|
|
+}
|