Skip to content

Commit

Permalink
tests/kola: adapt for new pure-RHEL variants
Browse files Browse the repository at this point in the history
A big part of the new variants added in
openshift/os#1445 is that we only minimally
modify `/etc/os-release`. This means that e.g. `ID` is still `rhel` and
`VERSION_ID` is e.g. `9.4` for the `rhel-9.4` variant. We do still
inject `VARIANT` and `VARIANT_ID` though.

Adapt these library functions here to handle this.
  • Loading branch information
jlebon committed Jun 19, 2024
1 parent bbbf0c4 commit 19daddd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/kola/data/commonlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ is_fcos() {
# Note when using this, you probably also want to check `get_rhel_maj_ver`.
is_rhcos() {
source /etc/os-release
{ [ "${ID}" == "rhel" ] && [ "${VARIANT_ID}" == "coreos" ]; } || \
[ "${ID}" == "rhcos" ]
}

Expand All @@ -46,13 +47,20 @@ get_fedora_ver() {

get_rhel_maj_ver() {
source /etc/os-release
echo "${RHEL_VERSION%%.*}"
if [ "${ID}" == "rhcos" ]; then
echo "${RHEL_VERSION%%.*}"
elif [ "${ID}" == "rhel" ]; then
echo "${VERSION_ID%%.*}"
else
fatal "Unknown ID $ID"
fi
}

# rhcos9
is_rhcos9() {
source /etc/os-release
[ "${ID}" == "rhcos" ] && [ "${RHEL_VERSION%%.*}" -eq 9 ]
{ [ "${ID}" == "rhcos" ] && [ "${RHEL_VERSION%%.*}" -eq 9 ]; } || \
{ [ "${ID}" == "rhel" ] && [ "${VERSION_ID%%.*}" -eq 9 ]; }
}

# scos
Expand Down

0 comments on commit 19daddd

Please sign in to comment.