Merge pull request #6391 from chuanchang/add_test_for_image_history_and_exporting
test.apiv2: add testing for displaying image history and exporting image
This commit is contained in:
commit
4b2c980e0f
|
|
@ -33,4 +33,27 @@ t GET images/$iid/json 200 \
|
|||
|
||||
#t POST images/create fromImage=alpine 201 foo
|
||||
|
||||
# Display the image history
|
||||
t GET libpod/images/nonesuch/history 404
|
||||
|
||||
for i in $iid ${iid:0:12} $PODMAN_TEST_IMAGE_NAME; do
|
||||
t GET libpod/images/$i/history 200 \
|
||||
.[0].Id=$iid \
|
||||
.[0].Created~[0-9]\\{10\\} \
|
||||
.[0].Tags=null \
|
||||
.[0].Size=0 \
|
||||
.[0].Comment=
|
||||
done
|
||||
|
||||
# Export an image on the local
|
||||
t GET libpod/images/nonesuch/get 404
|
||||
t GET libpod/images/$iid/get?format=foo 500
|
||||
t GET libpod/images/$PODMAN_TEST_IMAGE_NAME/get?compress=bar 400
|
||||
|
||||
for i in $iid ${iid:0:12} $PODMAN_TEST_IMAGE_NAME; do
|
||||
t GET "libpod/images/$i/get" 200 '[POSIX tar archive]'
|
||||
t GET "libpod/images/$i/get?compress=true" 200 '[POSIX tar archive]'
|
||||
t GET "libpod/images/$i/get?compress=false" 200 '[POSIX tar archive]'
|
||||
done
|
||||
|
||||
# vim: filetype=sh
|
||||
|
|
|
|||
|
|
@ -207,13 +207,21 @@ function t() {
|
|||
fi
|
||||
|
||||
cat $WORKDIR/curl.headers.out >>$LOG 2>/dev/null || true
|
||||
output=$(< $WORKDIR/curl.result.out)
|
||||
|
||||
# Log results. If JSON, filter through jq for readability
|
||||
if egrep -qi '^Content-Type: application/json' $WORKDIR/curl.headers.out; then
|
||||
jq . <<<"$output" >>$LOG
|
||||
else
|
||||
# Log results, if text. If JSON, filter through jq for readability.
|
||||
content_type=$(sed -ne 's/^Content-Type:[ ]\+//pi' <$WORKDIR/curl.headers.out)
|
||||
|
||||
if [[ $content_type =~ /octet ]]; then
|
||||
output="[$(file --brief $WORKDIR/curl.result.out)]"
|
||||
echo "$output" >>$LOG
|
||||
else
|
||||
output=$(< $WORKDIR/curl.result.out)
|
||||
|
||||
if [[ $content_type =~ application/json ]]; then
|
||||
jq . <<<"$output" >>$LOG
|
||||
else
|
||||
echo "$output" >>$LOG
|
||||
fi
|
||||
fi
|
||||
|
||||
# Test return code
|
||||
|
|
@ -232,6 +240,7 @@ function t() {
|
|||
return
|
||||
fi
|
||||
|
||||
local i
|
||||
for i; do
|
||||
case "$i" in
|
||||
# Exact match on json field
|
||||
|
|
|
|||
Loading…
Reference in New Issue