test/system: Simplify checking if the image exists or not

Bats' 'run' helper is not necessary to merely check if a command
succeeded or not [1].  In this case, it's idiomatic to use the command
as the condition for an 'if' branch.

[1] https://bats-core.readthedocs.io/en/stable/writing-tests.html

https://github.com/containers/toolbox/pull/1378
This commit is contained in:
Debarshi Ray 2023-09-25 15:52:19 +02:00
parent 9f85e13da9
commit 0d43d22b5b

View file

@ -334,8 +334,7 @@ function pull_distro_image() {
fi
# No need to copy if the image is already available in Podman
run "$PODMAN" image exists "${image}"
if [[ "$status" -eq 0 ]]; then
if "$PODMAN" image exists "${image}"; then
return
fi