From 701ce32b5b1b74578cdb213803cbf813f641d003 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Wed, 22 Mar 2023 11:00:47 +0100 Subject: [PATCH] test/system: Ensure that both non-Toolbx containers & images are skipped https://github.com/containers/toolbox/pull/1273 --- test/system/102-list.bats | 23 +++++++++++++++++++++++ test/system/libs/helpers.bash | 8 ++++++++ 2 files changed, 31 insertions(+) diff --git a/test/system/102-list.bats b/test/system/102-list.bats index e7d7d3575..0753c746e 100644 --- a/test/system/102-list.bats +++ b/test/system/102-list.bats @@ -337,3 +337,26 @@ teardown() { assert [ ${#lines[@]} -eq 5 ] assert [ ${#stderr_lines[@]} -eq 0 ] } + +@test "list: With just one non-Toolbx container and one non-Toolbx image" { + local busybox_image + busybox_image="$(get_busybox_image)" + + pull_distro_image busybox + + local num_of_images + num_of_images="$(list_images)" + assert_equal "$num_of_images" 1 + + $PODMAN create --name busybox-container "$busybox_image" + + local num_of_containers + num_of_containers="$(list_containers)" + assert_equal "$num_of_containers" 1 + + run --keep-empty-lines --separate-stderr $TOOLBOX list + + assert_success + assert [ ${#lines[@]} -eq 0 ] + assert [ ${#stderr_lines[@]} -eq 0 ] +} diff --git a/test/system/libs/helpers.bash b/test/system/libs/helpers.bash index bd3304330..5f56e4f9a 100644 --- a/test/system/libs/helpers.bash +++ b/test/system/libs/helpers.bash @@ -259,6 +259,14 @@ function check_bats_version() { } +function get_busybox_image() { + local image + image="${IMAGES[busybox]}" + echo "$image" + return 0 +} + + function get_default_image() { local distro local image