summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-01-27 16:49:47 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-01-27 16:49:47 +0100
commit15caebfe561952eaadd4896b7efb56f26724cce5 (patch)
treea0f9abfb073e3628bee609f32a93fcc1f6630f09 /test
parent2ff4da9b59df27584e436ff59a9d12b2c5e5e410 (diff)
downloadpodman-15caebfe561952eaadd4896b7efb56f26724cce5.tar.gz
podman-15caebfe561952eaadd4896b7efb56f26724cce5.tar.bz2
podman-15caebfe561952eaadd4896b7efb56f26724cce5.zip
podman build --pull: use correct policy
The `--pull` flag should be using the "pull if newer" pull policy rather than "pull always". This aligns with what the help message states, what Buildah does and, according to #9111, what was done before, Also add a test to prevent future regressions. Fixes: #9111 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/070-build.bats23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 7a42a4c18..6b5bc68fb 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -29,6 +29,29 @@ EOF
run_podman rmi -f build_test
}
+@test "podman build - basic test with --pull" {
+ rand_filename=$(random_string 20)
+ rand_content=$(random_string 50)
+
+ run_podman tag $IMAGE localhost/localonly
+
+ tmpdir=$PODMAN_TMPDIR/build-test
+ mkdir -p $tmpdir
+ dockerfile=$tmpdir/Dockerfile
+ cat >$dockerfile <<EOF
+FROM localhost/localonly
+RUN echo $rand_content > /$rand_filename
+EOF
+ # With --pull, Podman would try to pull a newer image but use the local one
+ # if present. See #9111.
+ run_podman build --pull -t build_test $tmpdir
+
+ run_podman run --rm build_test cat /$rand_filename
+ is "$output" "$rand_content" "reading generated file in image"
+
+ run_podman rmi -f build_test localhost/localonly
+}
+
@test "podman build - global runtime flags test" {
skip_if_remote "--runtime-flag flag not supported for remote"