Skip to content

Commit

Permalink
Merge pull request containers#7426 from Edward5hen/apiv2-containers-test
Browse files Browse the repository at this point in the history
APIv2 test: add more tests for containers
  • Loading branch information
openshift-merge-robot authored Sep 2, 2020
2 parents eb31d8c + 43ad9be commit 96079e2
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions test/apiv2/25-containersMore.at
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# -*- sh -*-
#
# test more container-related endpoints
#

podman pull $IMAGE &>/dev/null

# Ensure clean slate
podman rm -a -f &>/dev/null

podman run -d --name foo $IMAGE top

# Check exists for none such
t GET libpod/containers/nonesuch/exists 404

# Check container foo exists
t GET libpod/containers/foo/exists 204

# Pause the container
t POST libpod/containers/foo/pause '' 204

t GET libpod/containers/foo/json 200 \
.Id~[0-9a-f]\\{64\\} \
.State.Status=paused \
.ImageName=$IMAGE \
.Config.Cmd[0]=top \
.Name=foo

# Unpause the container
t POST libpod/containers/foo/unpause '' 204

t GET libpod/containers/foo/json 200 \
.Id~[0-9a-f]\\{64\\} \
.State.Status=running \
.ImageName=$IMAGE \
.Config.Cmd[0]=top \
.Name=foo

# List processes of the container
t GET libpod/containers/foo/top 200 \
length=2

# List processes of none such
t GET libpod/containers/nonesuch/top 404

# Mount the container to host filesystem
t POST libpod/containers/foo/mount '' 200
like "$output" ".*merged" "Check container mount"

# Unmount the container
t POST libpod/containers/foo/unmount '' 204

t DELETE libpod/containers/foo?force=true 204

# vim: filetype=sh

0 comments on commit 96079e2

Please sign in to comment.