From 22225417d97924cc0213caa44dd2b931f2bf397b Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Wed, 4 Dec 2024 15:08:01 -0500 Subject: [PATCH] tests: fix boot.bootupd-validate on rhel-9.6 In the el-only variants, there is no `RHEL_VERSION` since the RHEL version _is_ `VERSION_ID`. Add a new `get_rhel_ver` commonlib function to abstract this away and use that in the test. Don't bother checking for the `VARIANT_ID`. We only care about the coreos variant in the tests in this repo. (And once we start moving tests to fedora-bootc, we would want to remove these checks anyway.) --- tests/kola/boot/bootupd-validate | 2 +- tests/kola/data/commonlib.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/kola/boot/bootupd-validate b/tests/kola/boot/bootupd-validate index 4650dae372..5948f6296e 100755 --- a/tests/kola/boot/bootupd-validate +++ b/tests/kola/boot/bootupd-validate @@ -84,7 +84,7 @@ validate() { # should remove this until https://issues.redhat.com/browse/RHEL-66584 is fixed set_selinux_permissve() { source /etc/os-release - if is_scos || ([ "${RHEL_VERSION}" == "9.6" ] && [ "${VARIANT_ID}" == "coreos" ] ); then + if is_scos || [ "$(get_rhel_ver)" = "9.6" ]; then semanage permissive -a bootupd_t fi } diff --git a/tests/kola/data/commonlib.sh b/tests/kola/data/commonlib.sh index f5efd93bda..40557bdfc3 100644 --- a/tests/kola/data/commonlib.sh +++ b/tests/kola/data/commonlib.sh @@ -57,17 +57,22 @@ get_fedora_ver() { fi } -get_rhel_maj_ver() { +get_rhel_ver() { source /etc/os-release if [ "${ID}" == "rhcos" ]; then - echo "${RHEL_VERSION%%.*}" + echo "${RHEL_VERSION}" elif [ "${ID}" == "rhel" ]; then - echo "${VERSION_ID%%.*}" + echo "${VERSION_ID}" else fatal "Unknown ID $ID" fi } +get_rhel_maj_ver() { + local ver; ver=$(get_rhel_ver) + echo "${ver%%.*}" +} + # rhcos9 is_rhcos9() { source /etc/os-release