summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/20-containers.at2
-rw-r--r--test/apiv2/22-stop.at24
-rw-r--r--test/e2e/libpod_suite_test.go2
-rw-r--r--test/system/030-run.bats17
4 files changed, 44 insertions, 1 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index a69e8cc99..3a5d5a398 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -22,7 +22,7 @@ t GET libpod/containers/json?all=true 200 \
.[0].Id~[0-9a-f]\\{12\\} \
.[0].Image=$IMAGE \
.[0].Command[0]="true" \
- .[0].State=exited \
+ .[0].State~\\\(exited\\\|stopped\\\) \
.[0].ExitCode=0 \
.[0].IsInfra=false
diff --git a/test/apiv2/22-stop.at b/test/apiv2/22-stop.at
new file mode 100644
index 000000000..11318ca81
--- /dev/null
+++ b/test/apiv2/22-stop.at
@@ -0,0 +1,24 @@
+# -*- sh -*-
+#
+# test 'stop' endpoints
+#
+
+podman pull $IMAGE &>/dev/null
+
+# stop, by name
+podman run -dt --name mytop $IMAGE top &>/dev/null
+
+t GET libpod/containers/mytop/json 200 .State.Status=running
+t POST libpod/containers/mytop/stop "" 204
+t GET libpod/containers/mytop/json 200 .State.Status~\\\(exited\\\|stopped\\\)
+t DELETE libpod/containers/mytop 204
+
+# stop, by ID
+# Remember that podman() hides all output; we need to get our CID via inspect
+podman run -dt --name mytop $IMAGE top
+
+t GET libpod/containers/mytop/json 200 .State.Status=running
+cid=$(jq -r .Id <<<"$output")
+t POST libpod/containers/$cid/stop "" 204
+t GET libpod/containers/mytop/json 200 .State.Status~\\\(exited\\\|stopped\\\)
+t DELETE libpod/containers/mytop 204
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 43f08bf03..dc5e91c72 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -122,6 +122,8 @@ func populateCache(podman *PodmanTestIntegration) {
for _, image := range CACHE_IMAGES {
podman.RestoreArtifactToCache(image)
}
+ // logformatter uses this to recognize the first test
+ fmt.Printf("-----------------------------\n")
}
func removeCache() {
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index f1e9776c1..b89c76981 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -136,4 +136,21 @@ echo $rand | 0 | $rand
run_podman rmi busybox
}
+# 'run --rmi' deletes the image in the end unless it's used by another container.
+@test "podman run --rmi - remove image" {
+ skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
+ run_podman 0 run --rmi --rm redis /bin/true
+ run_podman 1 image exists redis
+}
+
+
+@test "podman run --rmi - not remove image" {
+ skip_if_remote "podman-remote does not emit 'Trying to pull' msgs"
+ run_podman run redis /bin/true
+ run_podman images | grep redis
+ run_podman run --rmi --rm redis /bin/true
+ run_podman images | grep redis
+ run_podman 0 rm -a
+}
+
# vim: filetype=sh