2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 17:02:15 +00:00

test(xcat-core): the dual-stack DHCPv6 case measured nothing

makedhcp_dhcpv6_dual_stack_boot_server defined its network and went straight to
makedhcp <node>. A reservation only reaches a subnet that kea-dhcp6.conf already carries, so
makedhcp skipped the node with "Unable to find a Kea DHCPv6 subnet", exited 0, and the case
asserted an empty bootfile-url against the expected one. The run reported the case as failing
for the wrong reason, and an assertion on the exit status alone would have passed.

The case now runs makedhcp -n after makehosts, as makedhcp_dhcpv6_boot_intent does, and asserts
two things the earlier version could not tell apart: that the subnet is in the configuration, and
that the node has exactly one reservation. A skip now fails on the reservation count rather than
on the URL.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-27 06:29:12 -03:00
parent 21359734b2
commit 47efd8bd34
@@ -321,10 +321,24 @@ cmd:mkdef -t node ci-ipv6-ds groups=all mgt=kvm netboot=grub2 ip=2001:db8:177::2
check:rc==0
cmd:makehosts ci-ipv6-ds
check:rc==0
# REGENERATE THE SERVER CONFIG. makedhcp <node> only writes a reservation into a subnet that is
# already in kea-dhcp6.conf, so without this the node has no subnet, makedhcp SKIPS it with a
# warning and still exits 0 -- and an assertion on the exit status alone then passes while
# nothing was measured.
cmd:makedhcp -n
check:rc==0
# The subnet must be there, or the next assertions cannot tell a skipped node from a wrong URL.
cmd:python3 -c 'import json;d=json.load(open("/etc/kea/kea-dhcp6.conf"));print(" ".join(s["subnet"] for s in d["Dhcp6"]["subnet6"]))'
check:rc==0
check:output=~2001:db8:177::/64
# makedhcp MUST SUCCEED. It resolved the tftpserver as IPv6, got no answer, and reported an error
# with errorcode 1, so the whole command exited 1 for a node that boots over IPv4.
cmd:makedhcp ci-ipv6-ds
check:rc==0
# The node MUST get a reservation. A skip leaves none and says so only in a warning.
cmd:python3 -c 'import json;d=json.load(open("/etc/kea/kea-dhcp6.conf"));print(sum(1 for s in d["Dhcp6"]["subnet6"] for r in s.get("reservations",[]) if r.get("hostname")=="ci-ipv6-ds"))'
check:rc==0
check:output==1
cmd:kea-dhcp6 -t /etc/kea/kea-dhcp6.conf
check:rc==0
# The boot URL survives, and its authority is the address of this management node that faces the