mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-04 20:51:44 +00:00
initial version of cli integration tests
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCommitAfterContainerIsDone(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", 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))
|
||||
|
||||
go deleteContainer(cleanedContainerID)
|
||||
go deleteImages(cleanedImageID)
|
||||
|
||||
logDone("commit - echo foo and commit the image")
|
||||
}
|
||||
Reference in New Issue
Block a user