mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-19 17:02:15 +00:00
test(xcat-core): xcattest skips every case on an openSUSE management node
xCAT::Test::OS::current_os returns undef on openSUSE. /etc/os-release carries
ID="opensuse-leap" and the word sles appears nowhere in it, so the os-release
arm falls through to its own return undef, and Leap ships none of
/etc/redhat-release, /etc/lsb-release or /etc/SuSE-release to reach another arm.
xcattest then warns "Use of uninitialized value $currentos" four times per case
and rejects all of them: "Test case reg_linux_diskfull_installation_flat has an
invalid OS option - Linux" and "There is no valid case to run". 328 of the
shipped cases declare os:Linux, so an openSUSE management node runs none of
them. The message blames the case, and the cases are skipped rather than
failed, which reports no result at all.
Measured 2026-10-24 on xcat20-mn, an openSUSE Leap 15.6 management node:
current_os answered UNDEF, /etc/os-release holds ID="opensuse-leap" and
VERSION_ID="15.6", and none of the three fallback files exist.
Five assertions fail on this commit: Leap is recognised, at any Leap version,
the older ID="opensuse" spelling, Tumbleweed, and a Leap node matching an
os:Linux case. The fourteen that already existed pass, including the one that
holds the change down -- a distribution whose os-release names neither sles nor
openSUSE is still not recognised.
The same bug was fixed on 2026-09-18 in f7be54a1b, against the chain of greps
xcattest carried before xCAT::Test::OS existed. That branch was never merged,
3582c6ab1 rewrote the routine as a module without it, and its test lifted the
routine out of xcattest with a regex. This test loads the module instead.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -60,6 +60,56 @@ is(xCAT::Test::OS::current_os(a_system('lsb-release' => "DISTRIB_ID=Ubuntu\n")),
|
||||
'Ubuntu is named from lsb-release');
|
||||
is(xCAT::Test::OS::current_os(a_system('os-release' => qq{ID="sles"\nVERSION="15-SP6"\n})), 'sles',
|
||||
'SLES is named from os-release');
|
||||
|
||||
# openSUSE. /etc/os-release carries ID="opensuse-leap" and no "sles" anywhere, and Leap ships
|
||||
# none of redhat-release, lsb-release or SuSE-release, so current_os fell through its os-release
|
||||
# arm and returned undef. xcattest then warned "Use of uninitialized value $currentos" four
|
||||
# times per case and rejected every one: "Test case reg_linux_diskfull_installation_flat has an
|
||||
# invalid OS option - Linux / There is no valid case to run". 328 of the shipped cases declare
|
||||
# os:Linux, so an openSUSE management node ran none of them, and the two cases were skipped
|
||||
# rather than failed -- no result at all.
|
||||
#
|
||||
# Measured 2026-10-24 on xcat20-mn, an openSUSE Leap 15.6 management node: current_os answered
|
||||
# UNDEF, /etc/os-release holds ID="opensuse-leap" and VERSION_ID="15.6", and none of the three
|
||||
# fallback files exist.
|
||||
#
|
||||
# openSUSE answers with the SLE family rather than a name of its own, which was decided on
|
||||
# 2026-09-18 for the same bug against the routine xcattest carried before xCAT::Test::OS
|
||||
# existed. Leap and SLE of the same major share a package set, sles.pm claims leap15, and
|
||||
# xcat.org publishes the Leap dependencies under sles15. It also lets the 18 cases written
|
||||
# os:sles select a Leap node, which a separate name would not.
|
||||
my $LEAP_OS_RELEASE = <<'REL';
|
||||
NAME="openSUSE Leap"
|
||||
VERSION="15.6"
|
||||
ID="opensuse-leap"
|
||||
ID_LIKE="suse opensuse"
|
||||
VERSION_ID="15.6"
|
||||
PRETTY_NAME="openSUSE Leap 15.6"
|
||||
REL
|
||||
|
||||
is(xCAT::Test::OS::current_os(a_system('os-release' => $LEAP_OS_RELEASE)), 'sles',
|
||||
'openSUSE Leap is the SLE family whose package set it shares');
|
||||
|
||||
my $leap16 = $LEAP_OS_RELEASE;
|
||||
$leap16 =~ s/15\.6/16.0/g;
|
||||
is(xCAT::Test::OS::current_os(a_system('os-release' => $leap16)), 'sles',
|
||||
'at any Leap version, so a new release needs no change here');
|
||||
|
||||
# Leap 42.3, which the sles12 cell runs, spells its ID without the -leap suffix.
|
||||
my $leap42 = $LEAP_OS_RELEASE;
|
||||
$leap42 =~ s/ID="opensuse-leap"/ID="opensuse"/;
|
||||
$leap42 =~ s/15\.6/42.3/g;
|
||||
is(xCAT::Test::OS::current_os(a_system('os-release' => $leap42)), 'sles',
|
||||
'the older spelling, ID="opensuse", is recognised too');
|
||||
|
||||
is(xCAT::Test::OS::current_os(
|
||||
a_system('os-release' => qq{NAME="openSUSE Tumbleweed"\nID="opensuse-tumbleweed"\n})),
|
||||
'sles', 'Tumbleweed answers rather than falling through silently');
|
||||
|
||||
# The thing that actually broke: an empty answer matches no os: restriction at all.
|
||||
my @linux = xCAT::Test::OS::linux_aliases();
|
||||
ok(scalar(grep { xCAT::Test::OS::current_os(a_system('os-release' => $LEAP_OS_RELEASE)) =~ /$_/i } @linux),
|
||||
'an openSUSE Leap management node matches an os:Linux case');
|
||||
is(xCAT::Test::OS::current_os(a_system()), 'aix',
|
||||
'a system with none of the release files is aix, as before');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user