Merge pull request #5304 from vieux/convert_rm_tests

convert so rm tests to integration-cli
This commit is contained in:
unclejack
2014-04-18 21:11:18 +03:00
2 changed files with 39 additions and 181 deletions

View File

@@ -25,3 +25,42 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) {
logDone("rm - removed volume")
}
func TestRemoveContainerWithVolume(t *testing.T) {
cmd := exec.Command(dockerBinary, "run", "--name", "foo", "-v", "/srv", "busybox", "true")
if _, err := runCommand(cmd); err != nil {
t.Fatal(err)
}
cmd = exec.Command(dockerBinary, "rm", "-v", "foo")
if _, err := runCommand(cmd); err != nil {
t.Fatal(err)
}
deleteAllContainers()
logDone("rm - volume")
}
func TestRemoveContainerRunning(t *testing.T) {
cmd := exec.Command(dockerBinary, "run", "-d", "--name", "foo", "busybox", "sleep", "300")
if _, err := runCommand(cmd); err != nil {
t.Fatal(err)
}
// Test cannot remove running container
cmd = exec.Command(dockerBinary, "rm", "foo")
if _, err := runCommand(cmd); err == nil {
t.Fatalf("Expected error, can't rm a running container")
}
// Remove with -f
cmd = exec.Command(dockerBinary, "rm", "-f", "foo")
if _, err := runCommand(cmd); err != nil {
t.Fatal(err)
}
deleteAllContainers()
logDone("rm - running container")
}