mirror of
https://github.com/containers/podman.git
synced 2025-06-01 17:17:47 +08:00
APIv2 tests: add tests for stop
...and allow status 'stopped' in addition to 'exited'. Fixes: #5336 Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -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
|
||||
|
||||
|
24
test/apiv2/22-stop.at
Normal file
24
test/apiv2/22-stop.at
Normal file
@ -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
|
Reference in New Issue
Block a user