diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-03 20:31:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-03 20:31:44 +0100 |
commit | d5f5b2e8becfb3a6e13d8b3248e26f3fbe22bdb4 (patch) | |
tree | 88e0cd7ab7f094a5d6f37687532eac69e5e8e047 | |
parent | 3bc5f431d4df9724501a42a68e333f7e98a0b0cf (diff) | |
parent | 88cd6488166bc799645efac8f2df389a352b2653 (diff) | |
download | podman-d5f5b2e8becfb3a6e13d8b3248e26f3fbe22bdb4.tar.gz podman-d5f5b2e8becfb3a6e13d8b3248e26f3fbe22bdb4.tar.bz2 podman-d5f5b2e8becfb3a6e13d8b3248e26f3fbe22bdb4.zip |
Merge pull request #5379 from edsantiago/test_apiv2
APIv2 tests: add tests for stop
-rw-r--r-- | test/apiv2/20-containers.at | 2 | ||||
-rw-r--r-- | test/apiv2/22-stop.at | 24 |
2 files changed, 25 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 |