Added tests for inheritlabel fix

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
This commit is contained in:
flouthoc
2025-04-25 19:26:07 +02:00
committed by openshift-cherrypick-robot
parent b2a99aab3f
commit 58a934313f

26
test/apiv2/90-build.at Normal file
View File

@ -0,0 +1,26 @@
# -*- sh -*-
#
# Tests for build-related endpoints
#
# test if default compat build contains labels from base image
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 $IMAGE
RUN echo hello
EOF
tar --format=posix -C $TMPD -cvf ${CONTAINERFILE_TAR} containerfile &> /dev/null
t POST "/build?dockerfile=containerfile&t=labeltest" $CONTAINERFILE_TAR 200 \
'.aux|select(has("ID")).ID~^sha256:[0-9a-f]\{64\}$'
t GET images/labeltest/json 200 \
.Config.Labels.created_by="test/system/build-testimage"
cleanBuildTest
# vim: filetype=sh