Skip to content

Commit

Permalink
.github/workflows, test/system: Enable 102-list.bats on Ubuntu 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
debarshiray committed Nov 11, 2024
1 parent b443428 commit 18ddaa4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ubuntu-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ jobs:
test/system/001-version.bats \
test/system/002-help.bats \
test/system/101-create.bats \
test/system/102-list.bats \
test/system/103-container.bats \
test/system/105-enter.bats \
test/system/106-rm.bats \
Expand Down
50 changes: 42 additions & 8 deletions test/system/102-list.bats
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,11 @@ teardown() {
local default_image
default_image="$(get_default_image)"

local system_id
system_id="$(get_system_id)"

local default_container
default_container="$(get_system_id)-toolbox-$(get_system_version)"
default_container="$system_id-toolbox-$(get_system_version)"

# Pull the two images
pull_default_image
Expand All @@ -393,18 +396,37 @@ teardown() {
run --keep-empty-lines --separate-stderr "$TOOLBX" list --images

assert_success
assert_line --index 1 --partial "registry.fedoraproject.org/fedora-toolbox:34"
assert_line --index 2 --partial "$default_image"

if [ "$system_id" = "fedora" ]; then
assert_line --index 1 --partial "registry.fedoraproject.org/fedora-toolbox:34"
assert_line --index 2 --partial "$default_image"
elif [ "$system_id" = "ubuntu" ]; then
assert_line --index 1 --partial "$default_image"
assert_line --index 2 --partial "registry.fedoraproject.org/fedora-toolbox:34"
else
fail "Define output for $system_id"
fi

assert [ ${#lines[@]} -eq 3 ]
assert [ ${#stderr_lines[@]} -eq 0 ]

# Check containers
run --keep-empty-lines --separate-stderr "$TOOLBX" list --containers

assert_success
assert_line --index 1 --partial "$default_container"
assert_line --index 2 --partial "non-default-one"
assert_line --index 3 --partial "non-default-two"

if [ "$system_id" = "fedora" ]; then
assert_line --index 1 --partial "$default_container"
assert_line --index 2 --partial "non-default-one"
assert_line --index 3 --partial "non-default-two"
elif [ "$system_id" = "ubuntu" ]; then
assert_line --index 1 --partial "non-default-one"
assert_line --index 2 --partial "non-default-two"
assert_line --index 3 --partial "$default_container"
else
fail "Define output for $system_id"
fi

assert [ ${#lines[@]} -eq 4 ]
assert [ ${#stderr_lines[@]} -eq 0 ]

Expand All @@ -425,6 +447,9 @@ teardown() {
local default_image
default_image="$(get_default_image)"

local system_id
system_id="$(get_system_id)"

pull_default_image
pull_distro_image fedora 34
build_image_without_name >/dev/null
Expand All @@ -437,8 +462,17 @@ teardown() {

assert_success
assert_line --index 1 --partial "<none>"
assert_line --index 2 --partial "registry.fedoraproject.org/fedora-toolbox:34"
assert_line --index 3 --partial "$default_image"

if [ "$system_id" = "fedora" ]; then
assert_line --index 2 --partial "registry.fedoraproject.org/fedora-toolbox:34"
assert_line --index 3 --partial "$default_image"
elif [ "$system_id" = "ubuntu" ]; then
assert_line --index 2 --partial "$default_image"
assert_line --index 3 --partial "registry.fedoraproject.org/fedora-toolbox:34"
else
fail "Define output for $system_id"
fi

assert [ ${#lines[@]} -eq 4 ]
assert [ ${#stderr_lines[@]} -eq 0 ]
}
Expand Down

0 comments on commit 18ddaa4

Please sign in to comment.