From 43e6399fc8894346027d082d2674ee7e69523535 Mon Sep 17 00:00:00 2001 From: Penn Bauman Date: Fri, 6 Sep 2024 16:41:24 -0700 Subject: [PATCH] test/system: Fix create tests for host distro/version 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 --- test/system/101-create.bats | 48 +++++++++++++++++++++++++++++------ test/system/libs/helpers.bash | 5 ++++ 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/test/system/101-create.bats b/test/system/101-create.bats index 2de00fb75..bc5e3195b 100644 --- a/test/system/101-create.bats +++ b/test/system/101-create.bats @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/test/system/libs/helpers.bash b/test/system/libs/helpers.bash index 867aaeb1a..99a795836 100644 --- a/test/system/libs/helpers.bash +++ b/test/system/libs/helpers.bash @@ -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