From f9baf6e05becbca92a71651db398a98f09e55d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sun, 6 Sep 2026 01:17:04 -0300 Subject: [PATCH] test(xCAT-test): follow the riscv64 netboot values naming Ubuntu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The assertion pinned the EL-only text and failed once the documented values named Ubuntu as well. Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com> --- xCAT-test/unit/lookup_netboot_arch.t | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/xCAT-test/unit/lookup_netboot_arch.t b/xCAT-test/unit/lookup_netboot_arch.t index d0491991b0..2b5801bfb1 100644 --- a/xCAT-test/unit/lookup_netboot_arch.t +++ b/xCAT-test/unit/lookup_netboot_arch.t @@ -2,11 +2,23 @@ use strict; use warnings; +use File::Path qw(make_path); +use File::Temp qw(tempdir); use FindBin; use lib "$FindBin::Bin/../lib"; use lib "$FindBin::Bin/../../perl-xCAT"; use Test::More; +# xCAT modules put $::XCATROOT/lib/perl ahead of @INC as they compile, so on a host with xCAT +# installed the schema, loaded after them, would come from /opt/xcat. XCATROOT points at this +# checkout before any of them compiles. +BEGIN { + my $root = tempdir( CLEANUP => 1 ); + make_path("$root/lib"); + symlink( "$FindBin::Bin/../../perl-xCAT", "$root/lib/perl" ) or die "symlink: $!"; + $ENV{XCATROOT} = $root; +} + use XCAT::Test::File qw(repo_path); use xCAT::ProfiledNodeUtils; use xCAT::Utils; @@ -56,9 +68,13 @@ is( xCAT::ProfiledNodeUtils::cal_netboot( $rule_table, [ 'aarch64', 'rhels', '9' # --------------------------------------------------------------------------- # Schema descriptions # --------------------------------------------------------------------------- -SKIP: { - skip 'xCAT::Schema is not loadable here', 5 - unless eval { require lib; lib->import( repo_path('perl-xCAT') ); require xCAT::Schema; 1 }; +# The schema comes from this checkout, not from an installed xCAT, or the descriptions checked +# below would be those of whatever version the host carries. +{ + require xCAT::Schema; + require Cwd; + like( Cwd::realpath( $INC{'xCAT/Schema.pm'} ), qr/^\Q@{[ Cwd::realpath( repo_path('perl-xCAT') ) ]}\E/, + 'xCAT::Schema is loaded from the checkout' ); like( $xCAT::Schema::tabspec{nodetype}{descriptions}{arch}, qr/\briscv64\b/, 'nodetype.arch documents riscv64 as a valid value' ); @@ -68,8 +84,9 @@ SKIP: { 'osimage.osarch documents riscv64 as a valid value' ); like( $xCAT::Schema::tabspec{osimage}{descriptions}{osarch}, qr/\bs390x\b/, 'osimage.osarch documents s390x as a valid value' ); - like( $xCAT::Schema::tabspec{noderes}{descriptions}{netboot}, qr/riscv64\s+>=el10\s+grub2,grub2-http,grub2-tftp/, - 'noderes.netboot documents the riscv64 grub2 methods' ); + like( $xCAT::Schema::tabspec{noderes}{descriptions}{netboot}, + qr/riscv64\s+>=el10, >=ubuntu24\.04\s+grub2,grub2-http,grub2-tftp/, + 'noderes.netboot documents the riscv64 grub2 methods for EL and Ubuntu' ); } done_testing();