Browse code

Add test for commiting container with bind mount Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)

Michael Crosby authored on 2014/05/20 07:57:29
Showing 1 changed files
... ...
@@ -83,3 +83,28 @@ func TestCommitTTY(t *testing.T) {
83 83
 		t.Fatal(err)
84 84
 	}
85 85
 }
86
+
87
+func TestCommitWithHostBindMount(t *testing.T) {
88
+	cmd := exec.Command(dockerBinary, "run", "--name", "bind-commit", "-v", "/dev/null:/winning", "busybox", "true")
89
+	if _, err := runCommand(cmd); err != nil {
90
+		t.Fatal(err)
91
+	}
92
+
93
+	cmd = exec.Command(dockerBinary, "commit", "bind-commit", "bindtest")
94
+	imageId, _, err := runCommandWithOutput(cmd)
95
+	if err != nil {
96
+		t.Fatal(err)
97
+	}
98
+	imageId = strings.Trim(imageId, "\r\n")
99
+
100
+	cmd = exec.Command(dockerBinary, "run", "bindtest", "true")
101
+
102
+	if _, err := runCommand(cmd); err != nil {
103
+		t.Fatal(err)
104
+	}
105
+
106
+	deleteAllContainers()
107
+	deleteImages(imageId)
108
+
109
+	logDone("commit - commit bind mounted file")
110
+}