summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2020-11-19 21:20:24 +0100
committerMatej Vasek <mvasek@redhat.com>2020-11-19 21:21:00 +0100
commit34931ac5dfc1b2d96e826b29bddcfcd3b0e6da35 (patch)
tree5c7360b10e7c6cec907db2bdfb3c3ffaa7b9a5d7
parent24ff6f45a23d87d413aff477bd3d40993c4b2218 (diff)
downloadpodman-34931ac5dfc1b2d96e826b29bddcfcd3b0e6da35.tar.gz
podman-34931ac5dfc1b2d96e826b29bddcfcd3b0e6da35.tar.bz2
podman-34931ac5dfc1b2d96e826b29bddcfcd3b0e6da35.zip
test resource cleanup
Signed-off-by: Matej Vasek <mvasek@redhat.com>
-rw-r--r--test/apiv2/23-containersArchive.at8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/apiv2/23-containersArchive.at b/test/apiv2/23-containersArchive.at
index a6af6f739..459800196 100644
--- a/test/apiv2/23-containersArchive.at
+++ b/test/apiv2/23-containersArchive.at
@@ -23,6 +23,12 @@ HELLO_TAR="${TMPD}/hello.tar"
podman run -d --name "${CTR}" "${IMAGE}" top
+function cleanUpArchiveTest() {
+ podman container stop "${CTR}" &> /dev/null
+ podman container rm "${CTR}" &> /dev/null
+ rm -fr "${TMPD}" &> /dev/null
+}
+
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
@@ -34,6 +40,7 @@ curl "http://$HOST:$PORT/containers/${CTR}/archive?path=%2Ftmp%2F" \
if ! podman exec -it "${CTR}" "grep" "Hello" "/tmp/hello.txt" &> /dev/null ; then
echo -e "${red}NOK: The hello.txt file has not been uploaded.${nc}" 1>&2;
+ cleanUpArchiveTest
exit 1
fi
@@ -68,6 +75,7 @@ if [ "$(tar -xf "${TMPD}/body.tar" hello.txt --to-stdout)" != "Hello" ]; then
ARCHIVE_TEST_ERROR="1"
fi
+cleanUpArchiveTest
if [[ "${ARCHIVE_TEST_ERROR}" ]] ; then
exit 1;
fi