From 3e514bc6eecf137ff2c193de83ee3a5822edb4bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 30 Oct 2026 16:52:02 -0300 Subject: [PATCH] test(netboot): cover the NetworkManager defaults of EL10 images An EL10 image must turn off the automatic DHCP profiles. An EL9 image must keep the NetworkManager defaults, and an image without NetworkManager must get no NetworkManager configuration. --- xCAT-test/unit/imgutils_nic_profiles.t | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xCAT-test/unit/imgutils_nic_profiles.t b/xCAT-test/unit/imgutils_nic_profiles.t index bec60b5a3c..49a271027c 100644 --- a/xCAT-test/unit/imgutils_nic_profiles.t +++ b/xCAT-test/unit/imgutils_nic_profiles.t @@ -69,4 +69,19 @@ for my $os (qw(rhels10.1 rhels9.6)) { ok(!-e "$bare/etc/sysconfig" && !-e "$bare/etc/NetworkManager", "a $os image without either directory gets no profile"); } +for my $case (['rhels10.1', 1], ['rocky10.2', 1], ['rhels9.6', 0]) { + my ($os, $disabled) = @$case; + my $root = image('etc/NetworkManager/conf.d'); + imgutils::disable_auto_profiles($root, $os); + my $conf = "$root/etc/NetworkManager/conf.d/xcat.conf"; + if ($disabled) { + is(-f $conf ? read_text($conf) : '', "[main]\nno-auto-default=*\n", "a $os image turns off the automatic DHCP profiles"); + } else { + ok(!-e $conf, "a $os image keeps the NetworkManager defaults"); + } +} +my $without = image('etc'); +imgutils::disable_auto_profiles($without, 'rhels10.1'); +ok(!-e "$without/etc/NetworkManager", 'an image without NetworkManager gets no NetworkManager configuration'); + done_testing();