summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-03-26 15:44:02 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-03-27 05:33:30 -0400
commit4d5199537737b0cfef47d3d2700013a787126d21 (patch)
tree46da1fe2b2a51f437f592465e434c6487d17a1f8 /test/system
parent4d0b583340c37efbf175c00d75d75107a0b23f00 (diff)
downloadpodman-4d5199537737b0cfef47d3d2700013a787126d21.tar.gz
podman-4d5199537737b0cfef47d3d2700013a787126d21.tar.bz2
podman-4d5199537737b0cfef47d3d2700013a787126d21.zip
Fix podman build --pull-never
Currently pull policy is set incorrectly when users set --pull-never. Also pull-policy is not being translated correctly when using podman-remote. Fixes: #9573 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r--test/system/070-build.bats27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 8f6cdb46b..e5b68a0d8 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -668,6 +668,33 @@ EOF
run_podman image prune -f
}
+@test "podman build --pull-never" {
+ local tmpdir=$PODMAN_TMPDIR/build-test
+ mkdir -p $tmpdir
+
+ # First, confirm that --pull-never is a NOP if image exists locally
+ local random_string=$(random_string 15)
+
+ cat >$tmpdir/Containerfile <<EOF
+FROM $IMAGE
+RUN echo $random_string
+EOF
+
+ run_podman build -t build_test --pull-never $tmpdir
+ is "$output" ".*$random_string" "pull-never is OK if image already exists"
+ run_podman rmi build_test
+
+ # Now try an image that does not exist locally nor remotely
+ cat >$tmpdir/Containerfile <<EOF
+FROM quay.io/libpod/nosuchimage:nosuchtag
+RUN echo $random_string
+EOF
+
+ run_podman 125 build -t build_test --pull-never $tmpdir
+ is "$output" ".* pull policy is .never. but .* could not be found locally" \
+ "--pull-never fails with expected error message"
+}
+
@test "podman build --logfile test" {
tmpdir=$PODMAN_TMPDIR/build-test
mkdir -p $tmpdir