test/system: Test 'list' with a RHEL Toolbx image

This restores parts of commit e09de9f3e5.

https://github.com/containers/toolbox/pull/1273
This commit is contained in:
Debarshi Ray 2023-03-22 08:58:12 +01:00
parent aa9da193c6
commit 164c9eff36
2 changed files with 32 additions and 1 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bats
#
# Copyright © 2021 2022 Red Hat, Inc.
# Copyright © 2021 2023 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -27,6 +27,7 @@ load 'libs/helpers'
_pull_and_cache_distro_image "$system_id" "$system_version" || false
# Cache all images that will be needed during the tests
_pull_and_cache_distro_image fedora 34 || false
_pull_and_cache_distro_image rhel 8.7 || false
_pull_and_cache_distro_image busybox || false
# If run on Fedora Rawhide, cache 2 extra images (previous Fedora versions)
local rawhide_res="$(awk '/rawhide/' $os_release)"

View file

@ -148,6 +148,36 @@ teardown() {
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: RHEL 8.7 image" {
pull_distro_image rhel 8.7
local num_of_images
num_of_images="$(list_images)"
assert_equal "$num_of_images" 1
run --keep-empty-lines --separate-stderr "$TOOLBOX" list
assert_success
assert_line --index 1 --partial "registry.access.redhat.com/ubi8/toolbox:8.7"
assert [ ${#lines[@]} -eq 3 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: RHEL 8.7 image (using --images)" {
pull_distro_image rhel 8.7
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 "registry.access.redhat.com/ubi8/toolbox:8.7"
assert [ ${#lines[@]} -eq 3 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
@test "list: An image without a name" {
build_image_without_name >/dev/null