summaryrefslogtreecommitdiff
path: root/test/apiv2/10-images.at
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-01-17 08:44:40 -0700
committerEd Santiago <santiago@redhat.com>2020-01-17 09:59:22 -0700
commitc2f50499c9e344a4bff56719fe66fa846ae3064d (patch)
tree4c40cbde7622f0409682bf1674fece4581fe4b2f /test/apiv2/10-images.at
parentf5e614b63f641078b3a74b048f815fea54d03475 (diff)
downloadpodman-c2f50499c9e344a4bff56719fe66fa846ae3064d.tar.gz
podman-c2f50499c9e344a4bff56719fe66fa846ae3064d.tar.bz2
podman-c2f50499c9e344a4bff56719fe66fa846ae3064d.zip
Tests for API v2
Initial framework for testing the version 2 (HTTP) API. Includes a collection of tests for some of the existing endpoints. Not all tests are currently passing. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/apiv2/10-images.at')
-rw-r--r--test/apiv2/10-images.at36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at
new file mode 100644
index 000000000..243b35e9f
--- /dev/null
+++ b/test/apiv2/10-images.at
@@ -0,0 +1,36 @@
+# -*- sh -*-
+#
+# Tests for image-related endpoints
+#
+
+# FIXME: API doesn't support pull yet, so use podman
+podman pull -q $IMAGE
+
+# We want the SHA without the "sha256:" prefix
+full_iid=$(podman images --no-trunc --format '{{.ID}}' $IMAGE)
+iid=${full_iid##sha256:}
+
+t GET libpod/images/$iid/exists 204
+t GET libpod/images/$PODMAN_TEST_IMAGE_NAME/exists 204
+
+# FIXME: compare to actual podman info
+t GET libpod/images/json 200 \
+ .[0].Id=${iid}
+
+t GET libpod/images/$iid/json 200 \
+ .Id=$iid \
+ .RepoTags[0]=$IMAGE
+
+# Same thing, but with abbreviated image id
+t GET libpod/images/${iid:0:12}/json 200 \
+ .Id=$iid \
+ .RepoTags[0]=$IMAGE
+
+# FIXME: docker API incompatibility: libpod returns 'id', docker 'sha256:id'
+t GET images/$iid/json 200 \
+ .Id=sha256:$iid \
+ .RepoTags[0]=$IMAGE
+
+#t POST images/create fromImage=alpine 201 foo
+
+# vim: filetype=sh