From 706efff55bd39f3c13df8cf4cb5a9dae488fb410 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 28 Oct 2026 11:07:37 -0300 Subject: [PATCH] test(template): the autoyast media_url does not bracket an IPv6 master Template.pm built the media_url of each add-on product from the noderes substitution, which writes the address of the management node as it stands. An IPv6-only node was told to install from "http://2001:db8::1//install/...". The test covers the IPv6-only URL on the default port and on a custom port, and holds down that a node with IPv4 keeps the substitution. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/unit/template_ipv6_rendering.t | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xCAT-test/unit/template_ipv6_rendering.t b/xCAT-test/unit/template_ipv6_rendering.t index 6bb5825826..e1773089a8 100644 --- a/xCAT-test/unit/template_ipv6_rendering.t +++ b/xCAT-test/unit/template_ipv6_rendering.t @@ -63,6 +63,30 @@ is( 'dhcp --device=02:00:00:00:00:61 --noipv4 --ipv6=dhcp', 'IPv6-only Kickstart network fragment disables IPv4 and enables DHCPv6' ); +# The media_url of an autoyast add-on product. The table substitution writes the address of +# the management node as it stands, so an IPv6-only node was told to install from +# "http://2001:db8::1//install/leap15.6/x86_64", which is not a URL YaST can read. +is( + xCAT::Template::_sles_media_url(1, '[2001:db8::1]', '', '/install/leap15.6/x86_64'), + 'http://[2001:db8::1]//install/leap15.6/x86_64', + 'an IPv6-only node gets a bracketed media_url' +); +is( + xCAT::Template::_sles_media_url(1, '[2001:db8::1]', ':8080', '/install/leap15.6/x86_64'), + 'http://[2001:db8::1]:8080//install/leap15.6/x86_64', + 'a custom port follows the bracketed address' +); +is( + xCAT::Template::_sles_media_url(0, '[2001:db8::1]', '', '/install/leap15.6/x86_64'), + 'http://#TABLE:noderes:$NODE:nfsserver#//install/leap15.6/x86_64', + 'a node with IPv4 keeps the table substitution' +); +unlike( + xCAT::Template::_sles_media_url(1, '[2001:db8::1]', '', '/install/leap15.6/x86_64'), + qr{http://2001:db8::1}, + 'no unbracketed IPv6 authority reaches the media_url' +); + { package TemplateIPv6MacTable; sub new { return bless {}, shift; }