diff options
author | Alex Schultz <aschultz@redhat.com> | 2021-06-11 11:13:19 -0600 |
---|---|---|
committer | Alex Schultz <aschultz@redhat.com> | 2021-06-11 13:50:29 -0600 |
commit | ded2f004f04c174dbd2a143ade8f2d5daf6f42da (patch) | |
tree | 248a45373b649572ce9e79c66d8cba3425eb2d46 /test/apiv2/10-images.at | |
parent | a634b2cd5977c60f1907733efe07b61ba36271fb (diff) | |
download | podman-ded2f004f04c174dbd2a143ade8f2d5daf6f42da.tar.gz podman-ded2f004f04c174dbd2a143ade8f2d5daf6f42da.tar.bz2 podman-ded2f004f04c174dbd2a143ade8f2d5daf6f42da.zip |
Fall back to string for dockerfile parameter
a9cb824981db3fee6b8445b29e513c89e9b9b00b changed the expectations of the
dockerfile parameter to be json data however it's a string. In order to
support both, let's attempt json and fall back to a string if the json
parsing fails.
Closes #10660
Signed-off-by: Alex Schultz <aschultz@redhat.com>
Diffstat (limited to 'test/apiv2/10-images.at')
-rw-r--r-- | test/apiv2/10-images.at | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at index 037a4c01f..9e464dbc7 100644 --- a/test/apiv2/10-images.at +++ b/test/apiv2/10-images.at @@ -147,4 +147,39 @@ t GET "images/get?names=alpine&names=busybox" 200 '[POSIX tar archive]' img_cnt=$(tar xf "$WORKDIR/curl.result.out" manifest.json -O | jq "length") is "$img_cnt" 2 "number of images in tar archive" +# check build works when uploading container file as a tar, see issue #10660 +TMPD=$(mktemp -d podman-apiv2-test.build.XXXXXXXX) +function cleanBuildTest() { + podman rmi -a -f + rm -rf "${TMPD}" &> /dev/null +} +CONTAINERFILE_TAR="${TMPD}/containerfile.tar" +cat > $TMPD/containerfile << EOF +FROM quay.io/libpod/alpine_labels:latest +EOF +tar --format=posix -C $TMPD -cvf ${CONTAINERFILE_TAR} containerfile &> /dev/null + +curl -XPOST --data-binary @<(cat $CONTAINERFILE_TAR) \ + -H "content-type: application/x-tar" \ + --dump-header "${TMPD}/headers.txt" \ + -o "${TMPD}/response.txt" \ + "http://$HOST:$PORT/v1.40/libpod/build?dockerfile=containerfile" &> /dev/null + +BUILD_TEST_ERROR="" + +if ! grep -q '200 OK' "${TMPD}/headers.txt"; then + echo -e "${red}NOK: Image build from tar failed response was not 200 OK" + BUILD_TEST_ERROR="1" +fi + +if ! grep -q 'quay.io/libpod/alpine_labels' "${TMPD}/response.txt"; then + echo -e "${red}NOK: Image build from tar failed image name not in response" + BUILD_TEST_ERROR="1" +fi + +cleanBuildTest +if [[ "${BUILD_TEST_ERROR}" ]]; then + exit 1 +fi + # vim: filetype=sh |