github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/apiv2/22-stop.at (about)

     1  # -*- sh -*-
     2  #
     3  # test 'stop' endpoints
     4  #
     5  
     6  podman pull $IMAGE &>/dev/null
     7  
     8  # stop, by name
     9  podman run -dt --name mytop $IMAGE top &>/dev/null
    10  
    11  t GET  libpod/containers/mytop/json    200 .State.Status=running
    12  t POST libpod/containers/mytop/stop "" 204
    13  t GET  libpod/containers/mytop/json    200 .State.Status~\\\(exited\\\|stopped\\\)
    14  t DELETE libpod/containers/mytop       204
    15  
    16  # stop, by ID
    17  # Remember that podman() hides all output; we need to get our CID via inspect
    18  podman run -dt --name mytop $IMAGE top
    19  
    20  t GET  libpod/containers/mytop/json   200 .State.Status=running
    21  cid=$(jq -r .Id <<<"$output")
    22  t POST libpod/containers/$cid/stop "" 204
    23  t GET  libpod/containers/mytop/json   200 .State.Status~\\\(exited\\\|stopped\\\)
    24  t DELETE libpod/containers/mytop      204