test/system: add prefetch users to use cache image

When using a custom --root it will not have the image present and as
such cause a pull. We can however use our own local cache if present to
avoid the pull if we give the right podman options via
_PODMAN_TEST_OPTS.

I saw the volume quota test fail during the pull in openQA thus I
noticed this issue.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-04-11 18:34:42 +02:00
parent f691fa7dc4
commit 857b536507
2 changed files with 13 additions and 4 deletions

View File

@ -61,8 +61,15 @@ function teardown() {
vol_two="testvol2"
run_podman $safe_opts volume create --opt o=size=4m $vol_two
# prefetch image to avoid registry pulls because this is using a
# unique root which does not have the image already present.
# _PODMAN_TEST_OPTS is used to overwrite the podman options to
# make the function aware of the custom --root.
_PODMAN_TEST_OPTS="$safe_opts --storage-driver $(podman_storage_driver)" _prefetch $IMAGE
ctrname="testctr"
run_podman $safe_opts run -d --name=$ctrname -i -v $vol_one:/one -v $vol_two:/two $IMAGE top
# pull never to ensure the prefetch works correctly
run_podman $safe_opts run -d --pull=never --name=$ctrname -i -v $vol_one:/one -v $vol_two:/two $IMAGE top
run_podman $safe_opts exec $ctrname dd if=/dev/zero of=/one/oneMB bs=1M count=1
run_podman 1 $safe_opts exec $ctrname dd if=/dev/zero of=/one/twoMB bs=1M count=1

View File

@ -134,10 +134,12 @@ function setup() {
@test "podman checkpoint --export, with volumes" {
skip_if_remote "Test uses --root/--runroot, which are N/A over remote"
# To avoid network pull, copy $IMAGE straight to temp root
local p_opts="$(podman_isolation_opts ${PODMAN_TMPDIR}) --events-backend file"
run_podman save -o $PODMAN_TMPDIR/image.tar $IMAGE
run_podman $p_opts load -i $PODMAN_TMPDIR/image.tar
# prefetch image to avoid registry pulls because this is using a
# unique root which does not have the image already present.
# _PODMAN_TEST_OPTS is used to overwrite the podman options to
# make the function aware of the custom --root.
_PODMAN_TEST_OPTS="$p_opts --storage-driver $(podman_storage_driver)" _prefetch $IMAGE
# Create a volume, find unused network port, and create a webserv container
volname=v-$(safename)