diff options
author | Ed Santiago <santiago@redhat.com> | 2020-03-03 06:36:09 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2020-03-03 06:40:27 -0700 |
commit | 88cd6488166bc799645efac8f2df389a352b2653 (patch) | |
tree | 38bb19acd8df8c8fefd0562902d084958bc06f67 /test/apiv2/22-stop.at | |
parent | 1641ee61802ad5e13a9ddf0a20099fe31f73768d (diff) | |
download | podman-88cd6488166bc799645efac8f2df389a352b2653.tar.gz podman-88cd6488166bc799645efac8f2df389a352b2653.tar.bz2 podman-88cd6488166bc799645efac8f2df389a352b2653.zip |
APIv2 tests: add tests for stop
...and allow status 'stopped' in addition to 'exited'.
Fixes: #5336
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/apiv2/22-stop.at')
-rw-r--r-- | test/apiv2/22-stop.at | 24 |
1 files changed, 24 insertions, 0 deletions
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 |