From aa6a8a19e5f23eea728188f000e8df8b49b3d7a4 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, 27 Sep 2026 02:12:33 -0300 Subject: [PATCH] test(probe): cover the discovery download match The network boot script of the upstream loader and of xNBA, and the pxelinux configuration, start the discovery. A node script, a loader and a Genesis file do not. --- .../probe_utils_discovery_boot_download.t | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 xCAT-test/unit/probe_utils_discovery_boot_download.t diff --git a/xCAT-test/unit/probe_utils_discovery_boot_download.t b/xCAT-test/unit/probe_utils_discovery_boot_download.t new file mode 100644 index 000000000..900bd3dea --- /dev/null +++ b/xCAT-test/unit/probe_utils_discovery_boot_download.t @@ -0,0 +1,31 @@ +#!/usr/bin/env perl +# xcatprobe discovery marks the boot loader stage of an unknown node when it fetches its pxelinux +# configuration or its network boot script. The file names are the ones the TFTP and HTTP logs show. +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../../perl-xCAT"; +use lib "$FindBin::Bin/../../xCAT-probe/lib/perl"; + +use Test::More; + +require probe_utils; + +my @starts = ( + '/tftpboot/xcat/ipxe/nets/192.0.2.0_24', + '/tftpboot/xcat/ipxe/nets/192.0.2.0_24.uefi', + '/tftpboot/xcat/xnba/nets/192.0.2.0_24', + '/tftpboot/pxelinux.cfg/C0000200', +); +ok( probe_utils::discovery_boot_download($_), "$_ starts the discovery" ) for @starts; + +my @others = ( + '/tftpboot/xcat/ipxe/nodes/cn01', + '/tftpboot/xcat/ipxe/i386/undionly.kpxe', + '/tftpboot/xcat/genesis.kernel.x86_64', +); +ok( !probe_utils::discovery_boot_download($_), "$_ does not" ) for @others; +ok( !probe_utils::discovery_boot_download(undef), 'no file name does not' ); + +done_testing();