Skip to content

Commit

Permalink
systests: fixes for coping with extra systemd image
Browse files Browse the repository at this point in the history
We _usually_ have only one image in store, $IMAGE, but it's
perfectly fine to also have $SYSTEMD_IMAGE also. Fix a few
tests so they can handle that condition.

And, cleanup:
 - remove a no-longer-useful test ("podman load NEWNAME",
   functionality that was removed 2+ years ago in containers#8877)
 - reorder some tests in the image-mount test, to make
   them safer and easier to understand
 - use no-such-image, not no-such-container, in image-mount test.
   Computer don't care, but this human felt confused for a sec.

Signed-off-by: Ed Santiago <santiago@redhat.com>
  • Loading branch information
edsantiago authored and Luap99 committed Jun 1, 2023
1 parent 34c258b commit 543b809
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
19 changes: 11 additions & 8 deletions test/system/060-mount.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ load helpers
run_podman image mount $IMAGE
mount_path="$output"

# Make sure that `mount -a` prints a table
run_podman image mount -a
is "$output" "$IMAGE .*$mount_path"

test -d $mount_path

# Image is custom-built and has a file containing the YMD tag. Check it.
Expand All @@ -66,16 +62,23 @@ load helpers
run_podman image mount
is "$output" "$IMAGE *$mount_path" "podman image mount with no args"

# Clean up: -f since we mounted it twice
# Clean up, and make sure nothing is mounted any more
run_podman image umount -f $IMAGE
is "$output" "$iid" "podman image umount: image ID of what was umounted"

run_podman image umount $IMAGE
is "$output" "" "podman image umount: does not re-umount"

run_podman 125 image umount no-such-container
is "$output" "Error: no-such-container: image not known" \
"error message from image umount no-such-container"
run_podman 125 image umount no-such-image
is "$output" "Error: no-such-image: image not known" \
"error message from image umount no-such-image"

# Tests for mount -a. This may mount more than one image! (E.g. systemd)
run_podman image mount -a
is "$output" "$IMAGE .*$mount_path"

run_podman image umount -a
assert "$output" =~ "$iid" "Test image is unmounted"

run_podman image mount
is "$output" "" "podman image mount, no args, after umount"
Expand Down
10 changes: 0 additions & 10 deletions test/system/120-load.bats
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ verify_iid_and_name() {
run_podman images $fqin --format '{{.Repository}}:{{.Tag}}'
is "${lines[0]}" "$fqin" "image preserves name across save/load"

# Load with a new tag
local new_name=x1$(random_string 14 | tr A-Z a-z)
local new_tag=t1$(random_string 6 | tr A-Z a-z)
run_podman rmi $fqin

run_podman load -i $archive
run_podman images --format '{{.Repository}}:{{.Tag}}' --sort tag
is "${lines[0]}" "$IMAGE" "image is preserved"
is "${lines[1]}" "$fqin" "image is reloaded with old fqin"

# Clean up
run_podman rmi $fqin
}
Expand Down

0 comments on commit 543b809

Please sign in to comment.