mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-21 01:42:15 +00:00
test(netboot): hand the NetworkManager lease of the initrd to diskless roots
The stateless xcatroot of dracut_047, run in a chroot with NetworkManager leases of the dhclient and internal clients in the initrd, must copy both into the root under their own names. CI now runs the xcatroot test as root.
This commit is contained in:
@@ -50,7 +50,7 @@ jobs:
|
||||
status=0
|
||||
sudo sh -c 'cd "$1" && bats xCAT-test/native/getinstdisk_selection.bats' sh "$workdir" || status=1
|
||||
sudo sh -c 'cd "$1" && bats xCAT-test/native/syslog_log_directory.bats' sh "$workdir" || status=1
|
||||
sudo sh -c 'cd "$1" && prove -v xCAT-test/native/getinstdisk_installer.t xCAT-test/native/template_root_password.t xCAT-test/native/enablekdump_per_node.t xCAT-test/native/sudoer_password_source.t xCAT-test/native/remoteshell_credentials.t' sh "$workdir" || status=1
|
||||
sudo sh -c 'cd "$1" && prove -v xCAT-test/native/getinstdisk_installer.t xCAT-test/native/template_root_password.t xCAT-test/native/enablekdump_per_node.t xCAT-test/native/sudoer_password_source.t xCAT-test/native/remoteshell_credentials.t xCAT-test/native/openeuler_xcatroot.t' sh "$workdir" || status=1
|
||||
exit "$status"
|
||||
- name: Prepare xCAT syslog directory
|
||||
if: ${{ !cancelled() }}
|
||||
|
||||
@@ -28,6 +28,9 @@ exec chroot "$root" /bin/bash -c '
|
||||
printf "PAYLOAD="; cat /sysroot/native-marker
|
||||
if [ -f /sysroot/localdisk-ran ]; then echo LOCALDISK_RAN; fi
|
||||
if [ -f /hooks/initqueue/xcat.sh ]; then echo INITQUEUE_READY; fi
|
||||
for lease in /sysroot/var/lib/NetworkManager/*.lease; do
|
||||
[ -f "$lease" ] && printf "NMLEASE=%s:%s\n" "${lease##*/}" "$(cat "$lease")"
|
||||
done
|
||||
exit "$rc"
|
||||
'
|
||||
SH
|
||||
@@ -40,7 +43,7 @@ for my $variant (qw(dracut_047 dracut_105/stateless dracut_105/statelite)) {
|
||||
my $case = tempdir(DIR => $dir, CLEANUP => 1);
|
||||
my $root = "$case/root";
|
||||
my $payload = "$case/payload";
|
||||
make_path(map { "$root/$_" } qw(usr lib etc tmp sysroot hooks/initqueue));
|
||||
make_path(map { "$root/$_" } qw(usr lib etc tmp sysroot hooks/initqueue var/lib/NetworkManager));
|
||||
symlink('usr/bin', "$root/bin") or die $!;
|
||||
symlink('usr/sbin', "$root/sbin") or die $!;
|
||||
symlink('usr/lib64', "$root/lib64") or die $!;
|
||||
@@ -53,6 +56,7 @@ for my $variant (qw(dracut_047 dracut_105/stateless dracut_105/statelite)) {
|
||||
}
|
||||
write_file("$root/etc/resolv.conf", "nameserver 192.0.2.1\n");
|
||||
write_file("$root/tmp/dhclient.eth0.lease", "fixture lease\n");
|
||||
write_file("$root/var/lib/NetworkManager/$_-0f3e5a12-eth0.lease", "$_ lease\n") for qw(dhclient internal);
|
||||
write_file("$root/lib/dracut-lib.sh", <<'SH');
|
||||
hookdir=/hooks
|
||||
logger() { :; }
|
||||
@@ -93,6 +97,10 @@ SH
|
||||
like($output, qr/^PAYLOAD=native payload$/m, "$label extracts the actual image payload");
|
||||
like($output, qr/^INITQUEUE_READY$/m, "$label reaches the initqueue handoff");
|
||||
unlike($output, qr{localdisk: (?:No such file|Permission denied)}, "$label avoids an invalid optional script invocation");
|
||||
if ($variant eq 'dracut_047') {
|
||||
like($output, qr/^NMLEASE=$_-0f3e5a12-eth0\.lease:$_ lease$/m,
|
||||
"$label hands the $_ lease of NetworkManager to the root") for qw(dhclient internal);
|
||||
}
|
||||
if ($localdisk eq 'executable') {
|
||||
like($output, qr/^LOCALDISK_RAN$/m, "$label retains the legacy executable hook");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user