From de86c39b462d22993023ceee1029f51e464c4faf Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sun, 8 Nov 2026 17:39:09 -0300 Subject: [PATCH] test(xcat-core): Genesis ends net init on an address of the wrong family genesis_nic_has_address ends the wait for the boot nic on an address of either family. xcatd is on one family, so on a dual stack provisioning network the node can go on to getcert and getdestiny holding only the family xcatd is not on, with no route to the management node. The cases drive the three address helpers out of doxcat with a stub ip and assert what ends the wait for an IPv4 xcatd and for an IPv6 one. Two of the six fail before the change: "an IPv6 xcatd is not reached by an IPv4 address alone" and "an IPv4 xcatd is not reached by an IPv6 address alone". The other four pass before and after, so the file is not vacuous. No cell is in this state today, because an IPv6 cell serves no IPv4 pool and an IPv4 cell sends no router advertisement, so the boot nic gets one family. The form was still wrong. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/bats/genesis_net_init_family.bats | 75 +++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 xCAT-test/bats/genesis_net_init_family.bats diff --git a/xCAT-test/bats/genesis_net_init_family.bats b/xCAT-test/bats/genesis_net_init_family.bats new file mode 100644 index 0000000000..7982b435a7 --- /dev/null +++ b/xCAT-test/bats/genesis_net_init_family.bats @@ -0,0 +1,75 @@ +#!/usr/bin/env bats +# +# Net init ends when the boot nic can reach xcatd. xcatd is on one family, so a node that has an +# address of the OTHER family is not ready: on a dual stack provisioning network it would go on +# to getcert and getdestiny with no route to the management node. The earlier form ended the wait +# on an address of either family, which was right for an IPv6-only cell and wrong here. + +load 'helpers/shell_source' + +setup() +{ + DOXCAT="$(require_repo_file 'xCAT-genesis-scripts/usr/bin/doxcat')" + BIN="${BATS_TEST_TMPDIR}/bin"; mkdir -p "$BIN" + ADDR="${BATS_TEST_TMPDIR}/addr"; mkdir -p "$ADDR" + : >"$ADDR/v4"; : >"$ADDR/v6" + cat >"$BIN/ip" <>"$LIB" || { + echo "could not extract $f" >&2; return 1; } + done +} + +has_v4() { printf '2: boot0 inet 192.0.2.20/24 scope global\n' >"$ADDR/v4"; } +has_v6() { printf '2: boot0 inet6 2001:db8:188::20/64 scope global\n' >"$ADDR/v6"; } + +ready() +{ + run env PATH="$BIN:$PATH" XCATMASTER="$1" bash -c \ + ". '$LIB'; genesis_nic_has_address boot0 && echo READY || echo WAIT" + [ "$status" -eq 0 ] +} + +@test "an IPv6 xcatd is not reached by an IPv4 address alone" { + has_v4 + ready '2001:db8:188::1' + [ "$output" = WAIT ] +} + +@test "an IPv6 xcatd is reached once the IPv6 address arrives" { + has_v6 + ready '2001:db8:188::1' + [ "$output" = READY ] +} + +@test "an IPv4 xcatd is not reached by an IPv6 address alone" { + has_v6 + ready '192.168.1.1' + [ "$output" = WAIT ] +} + +@test "an IPv4 xcatd is reached once the IPv4 address arrives" { + has_v4 + ready '192.168.1.1' + [ "$output" = READY ] +} + +@test "with no xcatd address an address of either family ends the wait" { + has_v6 + ready '' + [ "$output" = READY ] +} + +@test "a link-local address alone never ends the wait" { + printf '2: boot0 inet6 fe80::1/64 scope link\n' >"$ADDR/v6" + ready '2001:db8:188::1' + [ "$output" = WAIT ] +}