Skip to content

Commit ee45782

Browse files
committed
test/system: fix podman load - from URL
The test pulled a new $IMAGE already because it runs the http server container. So this doesn't striclty ensure the load works correctly. Make sure to actually test the load of a different image, so we use $PODMAN_NONLOCAL_IMAGE_FQN for that like another load test already does. I noticed this as the image pull on the webserver start flaked in a openQA run. Using _prefetch should help to reduce the network pulls here as it caches the image locally once it is pulled for the first time. Signed-off-by: Paul Holzinger <[email protected]>
1 parent 20fb712 commit ee45782

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

test/system/120-load.bats

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,33 @@ verify_iid_and_name() {
220220
}
221221

222222
@test "podman load - from URL" {
223-
get_iid_and_name
224-
run_podman save $img_name -o $archive
225-
run_podman rmi $iid
223+
# Use a different image, not $IMAGE, as we need that for the webserver container.
224+
img1=${PODMAN_NONLOCAL_IMAGE_FQN}
225+
_prefetch $img1
226+
227+
run_podman images -a --format '{{.ID}} {{.Repository}}:{{.Tag}}' $img1
228+
images_output="$output"
229+
230+
archive=$PODMAN_TMPDIR/myimage-$(safename).tar
231+
run_podman save $img1 -o $archive
232+
run_podman rmi $img1
226233

227234
HOST_PORT=$(random_free_port)
228235
SERVER=http://127.0.0.1:$HOST_PORT
229236

230237
# Bind-mount the archive to a container running httpd
238+
local cname="cweb=$(safename)"
231239
run_podman run -d --name myweb -p "$HOST_PORT:80" \
232240
-v $archive:/var/www/image.tar:Z \
233241
-w /var/www \
234242
$IMAGE /bin/busybox-extras httpd -f -p 80
235243

236244
run_podman load -i $SERVER/image.tar
237-
verify_iid_and_name $img_name
238245

239-
run_podman rm -f -t0 myweb
246+
run_podman images -a --format '{{.ID}} {{.Repository}}:{{.Tag}}' $img1
247+
assert "$output" == "$images_output"
248+
249+
run_podman rm -f -t0 $cname
240250
}
241251

242252
@test "podman load - redirect corrupt payload" {

0 commit comments

Comments
 (0)