github.com/containers/podman/v5@v5.1.0-rc1/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    200
    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    200
    25  
    26  # Remember that podman() hides all output; we need to get our CID via inspect
    27  podman run -dt --name mytop $IMAGE top
    28  
    29  t GET  containers/mytop/json 200 .State.Status=running
    30  cid=$(jq -r .Id <<<"$output")
    31  t POST containers/$cid/stop?t=-1 204
    32  t POST "containers/$cid/wait" 200
    33  t GET  containers/mytop/json 200 .State.Status~\\\(exited\\\|stopped\\\)
    34  t DELETE containers/mytop    204