Skip to content

Commit

Permalink
test/system: Fix create tests for host distro/version
Browse files Browse the repository at this point in the history
When toolbx creates container for the host distro/version it does not
print the toolbx name, as it is the default, this causes a failed test
if the host disto/version is used in a create test
  • Loading branch information
pennbauman committed Sep 6, 2024
1 parent 5d76b8a commit 43e6399
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 8 deletions.
48 changes: 40 additions & 8 deletions test/system/101-create.bats
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ teardown() {

assert_success
assert_output --partial "Created container: arch-toolbox-latest"
assert_output --partial "Enter with: toolbox enter arch-toolbox-latest"
if [ "$(get_system_id)-toolbox-$(get_system_version)" = "arch-toolbox-latest" ]; then
assert_output --partial "Enter with: toolbox enter"
else
assert_output --partial "Enter with: toolbox enter arch-toolbox-latest"
fi

run podman ps -a

Expand All @@ -132,7 +136,11 @@ teardown() {

assert_success
assert_output --partial "Created container: arch-toolbox-latest"
assert_output --partial "Enter with: toolbox enter arch-toolbox-latest"
if [ "$(get_system_id)-toolbox-$(get_system_version)" = "arch-toolbox-latest" ]; then
assert_output --partial "Enter with: toolbox enter"
else
assert_output --partial "Enter with: toolbox enter arch-toolbox-latest"
fi

run podman ps -a

Expand All @@ -146,7 +154,11 @@ teardown() {

assert_success
assert_output --partial "Created container: arch-toolbox-latest"
assert_output --partial "Enter with: toolbox enter arch-toolbox-latest"
if [ "$(get_system_id)-toolbox-$(get_system_version)" = "arch-toolbox-latest" ]; then
assert_output --partial "Enter with: toolbox enter"
else
assert_output --partial "Enter with: toolbox enter arch-toolbox-latest"
fi

run podman ps -a

Expand All @@ -160,7 +172,11 @@ teardown() {

assert_success
assert_output --partial "Created container: fedora-toolbox-34"
assert_output --partial "Enter with: toolbox enter fedora-toolbox-34"
if [ "$(get_system_id)-toolbox-$(get_system_version)" = "fedora-toolbox-34" ]; then
assert_output --partial "Enter with: toolbox enter"
else
assert_output --partial "Enter with: toolbox enter fedora-toolbox-34"
fi

run podman ps -a

Expand All @@ -174,7 +190,11 @@ teardown() {

assert_success
assert_output --partial "Created container: rhel-toolbox-8.10"
assert_output --partial "Enter with: toolbox enter rhel-toolbox-8.10"
if [ "$(get_system_id)-toolbox-$(get_system_version)" = "rhel-toolbox-8.10" ]; then
assert_output --partial "Enter with: toolbox enter"
else
assert_output --partial "Enter with: toolbox enter rhel-toolbox-8.10"
fi

run podman ps -a

Expand All @@ -188,7 +208,11 @@ teardown() {

assert_success
assert_output --partial "Created container: ubuntu-toolbox-20.04"
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-20.04"
if [ "$(get_system_id)-toolbox-$(get_system_version)" = "ubuntu-toolbox-20.04" ]; then
assert_output --partial "Enter with: toolbox enter"
else
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-20.04"
fi

run $PODMAN ps --all

Expand All @@ -203,7 +227,11 @@ teardown() {

assert_success
assert_output --partial "Created container: ubuntu-toolbox-22.04"
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-22.04"
if [ "$(get_system_id)-toolbox-$(get_system_version)" = "ubuntu-toolbox-22.04" ]; then
assert_output --partial "Enter with: toolbox enter"
else
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-22.04"
fi

run $PODMAN ps --all

Expand All @@ -218,7 +246,11 @@ teardown() {

assert_success
assert_output --partial "Created container: ubuntu-toolbox-24.04"
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-24.04"
if [ "$(get_system_id)-toolbox-$(get_system_version)" = "ubuntu-toolbox-24.04" ]; then
assert_output --partial "Enter with: toolbox enter"
else
assert_output --partial "Enter with: toolbox enter ubuntu-toolbox-24.04"
fi

run $PODMAN ps --all

Expand Down
5 changes: 5 additions & 0 deletions test/system/libs/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@ function get_system_id() (
function get_system_version() (
local os_release

if [ "$(get_system_id)" = "arch" ]; then
echo "latest"
return
fi

os_release="$(find_os_release)"

if [[ -z "$os_release" ]]; then
Expand Down

0 comments on commit 43e6399

Please sign in to comment.