2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-07 01:56:56 +00:00
Files
xcat-core/xCAT-test/integration
Daniel Hilst 1a531128de fix(dhcp): close four more ISC/Kea drifts from the parity spec
Appendix A decisions 9, 21, 22 and 24. Each one is a difference an
operator never chose: the backend is picked by distribution version, so
whichever side is wrong is wrong on half the clusters.

9  -- Kea never loaded libdhcp_bootp.so, so a BOOTP-only client that ISC
      answered got nothing. The hook now sits alongside host_cmds in one
      hooks-libraries array, and when the hooks package is absent the
      operator is told which clients that leaves unanswered rather than
      being left to find out from a node that never boots.

21 -- The ISC host statements sent "send host-name", which is a dhcpd
      *client* keyword: it never reached option 12 and the node was
      handed no hostname at all. Kea has always sent one.

22 -- The PXE short lease existed on ISC in name only. dhcpd applies
      min-lease-time after max-lease-time, so the cluster default won and
      a pool address taken by a PXE ROM was held for half a day. The
      class now names all three bounds, and Kea is given the same 600
      seconds through xcat-pxe-lease.

24 -- ISC writes "authoritative;" into every generated subnet; Kea
      defaults to the opposite. A node that moved rack asked to keep an
      address from the network it had left and was answered with silence,
      so it waited out a lease that would never be renewed instead of
      being told to start over.

Also makes $xCAT_plugin::dhcp::callback a package variable. It was a file
lexical, so the tests' local() set something nothing read, and warnings
were only ever captured because an earlier process_request had left its
collector behind.
2026-09-10 13:38:32 -03:00
..

xCAT-test/integration

Integration tests. These run against an installed management node -- they need a real xCAT installation, and depending on the test a populated /install, a service binary they can execute, or a live daemon.

They are driven by xcattest through the testcase in ../autotest/testcase/integration/, which proves the copy installed by the xcat-test package:

prove -I/opt/xcat/lib/perl -I/opt/xcat/lib/perl/xCAT \
      -r /opt/xcat/share/xcat/tools/autotest/integration

Run the case by hand on an MN with:

xcattest -f <cluster.conf> -t integration_tests

The case carries the ci_test label, so it also runs on every pull request: the xcat_test GitHub Actions workflow installs and configures xCAT on the runner, which makes that runner a (single node) management node, and then runs every ci_test case against it.

Note the -I flags: unlike the unit tests these run from the installed location, so they pick up xCAT modules from /opt/xcat/lib/perl rather than from a source tree.

The case checks rc==0 and output=~Files=5,. The second assertion is there because prove exits 0 both when tests pass and when they all skip, so rc==0 alone would let the case report green having run nothing. Matching Files=5, proves prove actually found all five files, which catches a packaging regression or a test renamed away from .t without updating the count. Add to that number when you add a test. A missing directory is already caught by rc==0 -- prove -r on a path that does not exist exits 2.

Note also that github_action_xcat_test.pl invokes each case through sudo, so in CI these tests run as root while the unit tests run unprivileged. That is the right way round -- integration tests legitimately need to write to places like /etc/kea, whereas running the unit tests as root would let permission-related assertions pass for the wrong reason.

What belongs here

A test belongs in integration/ when it needs something the checkout cannot provide:

Test Requires
copycds_packages_integrity.t /install populated by a real copycds
dhcp_isc_config_validation.t a dhcpd binary that can read the generated config, as root
dhcp_kea_config_validation.t a kea-dhcp4 binary that can read the generated config
dhcp_kea_control_agent_smoke.t live kea-dhcp4 and kea-ctrl-agent, root, and the Kea host-commands hook
html_form_runtime_dependency.t the installed HTML::Form module

Environment guards

Tests with optional runtime dependencies guard with plan skip_all -- an MN with no Kea installed should skip the Kea tests, not go red. The HTML::Form test is different: it verifies a required installed dependency and fails when that module is absent. A skip in this directory is therefore expected and normal.

Which tests actually run consequently varies by node. On a GitHub runner, for example, /install is empty so copycds_packages_integrity.t skips, while dhcp_kea_config_validation.t does run because the case executes as root and can therefore validate from /etc/kea.

dhcp_kea_control_agent_smoke.t is opt-in on top of that:

plan skip_all => 'set XCAT_KEA_LIVE_SMOKE=1 to run live Kea daemon smoke test'
  unless $ENV{XCAT_KEA_LIVE_SMOKE};

It starts real Kea daemons, so it stays off unless asked for. Do not enable it on a node whose DHCP service is in use.

What does not belong here

Anything that only needs the checkout. Those go in ../unit and run on every pull request, which is much faster feedback than waiting for a cluster test.