|
@@ -34,6 +34,33 @@ func TestCommitAfterContainerIsDone(t *testing.T) {
|
|
|
logDone("commit - echo foo and commit the image")
|
|
|
}
|
|
|
|
|
|
+func TestCommitWithoutPause(t *testing.T) {
|
|
|
+ runCmd := exec.Command(dockerBinary, "run", "-i", "-a", "stdin", "busybox", "echo", "foo")
|
|
|
+ out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
|
|
+ errorOut(err, t, fmt.Sprintf("failed to run container: %v %v", out, err))
|
|
|
+
|
|
|
+ cleanedContainerID := stripTrailingCharacters(out)
|
|
|
+
|
|
|
+ waitCmd := exec.Command(dockerBinary, "wait", cleanedContainerID)
|
|
|
+ _, _, err = runCommandWithOutput(waitCmd)
|
|
|
+ errorOut(err, t, fmt.Sprintf("error thrown while waiting for container: %s", out))
|
|
|
+
|
|
|
+ commitCmd := exec.Command(dockerBinary, "commit", "-p", "false", cleanedContainerID)
|
|
|
+ out, _, err = runCommandWithOutput(commitCmd)
|
|
|
+ errorOut(err, t, fmt.Sprintf("failed to commit container to image: %v %v", out, err))
|
|
|
+
|
|
|
+ cleanedImageID := stripTrailingCharacters(out)
|
|
|
+
|
|
|
+ inspectCmd := exec.Command(dockerBinary, "inspect", cleanedImageID)
|
|
|
+ out, _, err = runCommandWithOutput(inspectCmd)
|
|
|
+ errorOut(err, t, fmt.Sprintf("failed to inspect image: %v %v", out, err))
|
|
|
+
|
|
|
+ deleteContainer(cleanedContainerID)
|
|
|
+ deleteImages(cleanedImageID)
|
|
|
+
|
|
|
+ logDone("commit - echo foo and commit the image")
|
|
|
+}
|
|
|
+
|
|
|
func TestCommitNewFile(t *testing.T) {
|
|
|
cmd := exec.Command(dockerBinary, "run", "--name", "commiter", "busybox", "/bin/sh", "-c", "echo koye > /foo")
|
|
|
if _, err := runCommand(cmd); err != nil {
|