2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-05 04:27:55 +00:00
Files
xcat-core/xCAT-test/unit/el10_netboot_dhcp_client.t
T
2026-08-24 21:50:51 -03:00

52 lines
1.8 KiB
Perl

#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Test::More;
use XCAT::Test::File qw(repo_path slurp_repo_file);
my $spec = slurp_repo_file('xCAT-server/xCAT-server.spec');
unlike( $spec, qr/\bdnf\s+download\b/, 'xCAT-server RPM scripts do not download packages' );
unlike( $spec, qr{/install/dhcp_pkgs}, 'xCAT-server RPM scripts do not write hidden DHCP package directories' );
my $anaconda = slurp_repo_file('xCAT-server/lib/xcat/plugins/anaconda.pm');
unlike( $anaconda, qr{/install/dhcp_pkgs}, 'copycds does not inject hidden DHCP package directories into pkgdir' );
my @pkglist_files = qw(
xCAT-server/share/xcat/netboot/rh/compute.rhels10.ppc64le.pkglist
xCAT-server/share/xcat/netboot/rh/compute.rhels10.x86_64.pkglist
);
my %el10_pkglist_aliases = (
'xCAT-server/share/xcat/netboot/rocky/compute.rocky10.ppc64le.pkglist' => '../rh/compute.rhels10.ppc64le.pkglist',
'xCAT-server/share/xcat/netboot/rocky/compute.rocky10.x86_64.pkglist' => '../rh/compute.rhels10.x86_64.pkglist',
);
foreach my $file ( sort keys %el10_pkglist_aliases ) {
my $path = repo_path($file);
is( readlink($path), $el10_pkglist_aliases{$file}, "$file uses the EL10 package list" );
}
foreach my $file (@pkglist_files) {
my $path = repo_path($file);
open( my $fh, '<', $path ) or die "Unable to read $path: $!";
my @packages;
while ( my $line = <$fh> ) {
chomp $line;
next if $line =~ /^\s*(?:#|$)/;
push @packages, $line;
}
close($fh);
my %packages = map { $_ => 1 } @packages;
ok( $packages{'NetworkManager'}, "$file uses NetworkManager for EL10 DHCP handling" );
ok( !$packages{'dhclient'}, "$file avoids removed dhclient package" );
ok( !$packages{'dhcp-client'}, "$file avoids removed dhcp-client package" );
}
done_testing();