mirror of
https://github.com/containers/podman.git
synced 2025-06-25 20:26:51 +08:00
add test
Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
28
test/apiv2/23-containersArchive.at
Normal file
28
test/apiv2/23-containersArchive.at
Normal file
@ -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
|
Reference in New Issue
Block a user