# -*- sh -*- # # test more container-related endpoints # podman pull $IMAGE &>/dev/null # Ensure clean slate podman rm -a -f &>/dev/null CTR="ArchiveTestingCtr$(random_string 5)" TMPD=$(mktemp -d podman-apiv2-test.archive.XXXXXXXX) HELLO_TAR="${TMPD}/hello.tar" HELLO_S="Hello_$(random_string 8)" echo "$HELLO_S" > $TMPD/hello.txt tar --owner=1042 --group=1043 --format=posix -C $TMPD -cvf ${HELLO_TAR} hello.txt &> /dev/null # Start a container, and wait for it. (I know we don't actually do anything # if we time out. If we do, subsequent tests will fail. I just want to avoid # a race between container-start and tests-start) podman run -d --name "${CTR}" "${IMAGE}" top timeout=10 while [[ $timeout -gt 0 ]]; do if podman container exists "${CTR}"; then break fi timeout=$((timeout - 1)) sleep 1 done 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 # Send tarfile to container... t PUT "/containers/${CTR}/archive?path=%2Ftmp%2F" ${HELLO_TAR} 200 '' # ...and 'exec cat file' to confirm that it got extracted into place. cat >$TMPD/exec.json <$TMPD/exec.json <