test/system: Test 'list' both with and without --images

https://github.com/containers/toolbox/pull/1278
This commit is contained in:
Debarshi Ray 2023-03-21 18:02:12 +01:00
parent 6890f5dc8d
commit 20fa122820

View file

@ -68,6 +68,20 @@ teardown() {
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: With just one non-Toolbx image (using --images)" {
pull_distro_image busybox
local num_of_images
num_of_images="$(list_images)"
assert_equal "$num_of_images" 1
run --keep-empty-lines --separate-stderr $TOOLBOX list --images
assert_success
assert [ ${#lines[@]} -eq 0 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: An image without a name" {
build_image_without_name >/dev/null
@ -79,6 +93,21 @@ teardown() {
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: An image without a name (using --images)" {
build_image_without_name >/dev/null
local num_of_images
num_of_images="$(list_images)"
assert_equal "$num_of_images" 1
run --keep-empty-lines --separate-stderr $TOOLBOX list --images
assert_success
assert_line --index 1 --partial "<none>"
assert [ ${#lines[@]} -eq 3 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: Image and its copy" {
local default_image
default_image="$(get_default_image)"
@ -98,6 +127,25 @@ teardown() {
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: Image and its copy (using --images)" {
local default_image
default_image="$(get_default_image)"
pull_default_image_and_copy
local num_of_images
num_of_images="$(list_images)"
assert_equal "$num_of_images" 2
run --keep-empty-lines --separate-stderr "$TOOLBOX" list --images
assert_success
assert_line --index 1 --partial "$default_image"
assert_line --index 2 --partial "$default_image-copy"
assert [ ${#lines[@]} -eq 4 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: Containers and images" {
# Pull the two images
pull_default_image
@ -140,6 +188,28 @@ teardown() {
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: Images with and without names" {
local default_image
default_image="$(get_default_image)"
pull_default_image
pull_distro_image fedora 34
build_image_without_name >/dev/null
local num_of_images
num_of_images="$(list_images)"
assert_equal "$num_of_images" 3
run --keep-empty-lines --separate-stderr "$TOOLBOX" list
assert_success
assert_line --index 1 --partial "<none>"
assert_line --index 2 --partial "fedora-toolbox:34"
assert_line --index 3 --partial "$default_image"
assert [ ${#lines[@]} -eq 5 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: Images with and without names (using --images)" {
local default_image
default_image="$(get_default_image)"