2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-07 10:06:39 +00:00
Files
xcat-core/xCAT-test
Daniel Hilst 838d2f6870 test(dhcp): a client naming itself takes over a Kea node's name
A Kea host reservation written by kea_node_reservations carries the node's
name only as a host-name option. Kea takes the name for the lease and for the
DDNS update from the reservation's "hostname" field, and with that field
absent it takes the name the client advertised instead.

Measured with kea-dhcp4 2.4.1 on a veth pair, ddns-qualifying-suffix
"cluster.local.", a reservation for 192.0.2.50 and a client sending option 12
"otherdesk":

  hostname field absent   option 12 -> otherdesk.cluster.local
                          lease     -> otherdesk.cluster.local (fqdn fwd+rev)
  hostname field present  option 12 -> node01.cluster.local
                          lease     -> node01.cluster.local

dhcp_kea_plugin_intent.t now asserts the reservation carries the hostname
field, and netboot-methods.conf adds S-35 "a node advertising another name is
still told its own". The existing S-35 step matches the node's label rather
than the whole option, because a server that qualifies the name with the
cluster domain has still answered with the node's own name.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-12 09:25:55 -03:00
..
2018-04-26 15:15:47 -04:00

xCAT-test

Unit tests that run from the source checkout are split by implementation language:

Test type Location Runner
Perl unit tests xCAT-test/unit/*.t prove -r xCAT-test/unit
Shell unit tests xCAT-test/bats/*.bats bats -r xCAT-test/bats
DHCP wire tests xCAT-test/dhcptest/ python3 -m unittest discover -s tests, then dhcptest run -i <nic> <conf>
CLI functional tests xCAT-test/autotest/testcase/ and xCAT-test/autotest/bundle/ xcattest -f <cluster.conf> -t <case> or xcattest -f <cluster.conf> -b <bundle>

Use Perl .t tests for Perl modules, Perl scripts, templates, and repository artifacts. Use BATS tests for shell-script behavior that can be exercised from the checkout by sourcing a shell library or script and shadowing external commands.

Shell behavior should not be tested by Perl tests that grep shell source. Put those tests under xCAT-test/bats instead.

dhcptest is the odd one out: its Python unit tests and dhcptest validate run offline like the others, but its point is the third column -- driving real DHCP transactions on a provisioning NIC and asserting on what came back. It talks to the server only over the wire, so it is agnostic to which DHCP implementation is answering and to xCAT itself.

See unit/README.md, bats/README.md and dhcptest/README.md for the detailed rules for each suite.