summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2020-11-19 05:39:34 +0100
committerMatej Vasek <mvasek@redhat.com>2020-11-19 20:31:47 +0100
commitd5cabc33375340fd59591dbba7c4474901bacd32 (patch)
tree41a0ea00fd15e4361c2a1f7c6d9cbebf98768d74 /test
parentbe7e9f63f241c826e3a5772da355a3d66d254c6c (diff)
downloadpodman-d5cabc33375340fd59591dbba7c4474901bacd32.tar.gz
podman-d5cabc33375340fd59591dbba7c4474901bacd32.tar.bz2
podman-d5cabc33375340fd59591dbba7c4474901bacd32.zip
add test
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/23-containersArchive.at28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/apiv2/23-containersArchive.at b/test/apiv2/23-containersArchive.at
new file mode 100644
index 000000000..fcbc4373c
--- /dev/null
+++ b/test/apiv2/23-containersArchive.at
@@ -0,0 +1,28 @@
+# -*- sh -*-
+#
+# test more container-related endpoints
+#
+
+podman pull $IMAGE &>/dev/null
+
+# Ensure clean slate
+podman rm -a -f &>/dev/null
+
+CTR="ArchiveTestingCtr"
+
+TMPD=$(mktemp -d)
+pushd "${TMPD}"
+echo "Hello!" > "hello.txt" &> /dev/null
+tar --format=posix -cvf "hello.tar" "hello.txt" &> /dev/null
+popd
+
+HELLO_TAR="${TMPD}/hello.tar"
+
+podman run -d --name "${CTR}" "${IMAGE}" top
+
+t HEAD "containers/nonExistentCtr/archive?path=%2F" 404
+t HEAD "containers/${CTR}/archive?path=%2Fnon%2Fexistent%2Fpath" 404
+t HEAD "containers/${CTR}/archive?path=%2Fetc%2Fpasswd" 200
+
+curl "http://127.0.0.1:$PORT/containers/${CTR}/archive?path=%2Ftmp" -X PUT --upload-file "${HELLO_TAR}"
+t HEAD "containers/${CTR}/archive?path=%2Ftmp%2Fhello.txt" 200