From 0d43d22b5b810fa2c049f6d0951e676ccdc35264 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Mon, 25 Sep 2023 15:52:19 +0200 Subject: [PATCH] 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 --- test/system/libs/helpers.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/system/libs/helpers.bash b/test/system/libs/helpers.bash index f4132d0..f323079 100644 --- a/test/system/libs/helpers.bash +++ b/test/system/libs/helpers.bash @@ -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