2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-21 01:42:15 +00:00
Commit Graph

6 Commits

Author SHA1 Message Date
Daniel Hilst b7076359f4 fix(xcat-test): xcat-test can install without python3 on Debian
python3-scapy was the only Depends of xcat-test that pulled in
python3. With scapy moved to Recommends, apt-get install
--no-install-recommends xcat-test can leave python3 absent, and every
blackboxtest command fails before it starts, not only the DHCP steps.

Add python3 to Depends. xcat_test_scapy_optional.t checks that python3
is a hard Depends, and fails without this change.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-29 14:42:47 -03:00
Daniel Hilst 8c2ecab18c fix(xcat-test): scapy is a hard Depends on Debian and only a Recommends on EL
Only blackboxtest's DHCP steps need scapy. dhcp.py is the single module that
imports it, inside scapy_module(), which raises UnsupportedError naming
python3-scapy when the import fails -- so xcat-test installs and every other
blackboxtest step runs without it. xCAT-test.spec has only ever RECOMMENDED the
package, and says why in a comment: a hard Requires: would make xcat-test
uninstallable on a management node without EPEL. debian/control answered the
same question with Depends:, which is the asymmetry this fixes.

The cost is not theoretical. `apt-get install -y xcat-test` installs Recommends
by default and python3-scapy recommends matplotlib, scipy and ipython3 -- 54
packages, about 255 MB -- inside a workflow step capped at 1200 seconds. On
2026-10-23 that download stalled and killed xcat_pr_test on xcat-core/#7974 at
exactly 1200s, step 21, while a sibling run on another runner did the same
install in 19 seconds. The job does 50 to 55 minutes of work against a
60-minute timeout, so a dependency of that size is most of its headroom.

Moving it to Recommends does not by itself stop apt pulling it: an installer
that wants the small package set has to ask, with --no-install-recommends. What
this changes is that xcat-test no longer REQUIRES 255 MB to install, which is
what the spec already said and what the code already supported.

xcat_test_scapy_optional.t asserts both packagings give the same answer: scapy
absent from Depends, present in Recommends, the perl dependency still a Depends,
and the spec recommending rather than requiring it. Restoring the hard Depends
fails one assertion; deleting the Recommends outright -- the other tempting
answer -- fails a different one.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-23 17:27:17 -03:00
Daniel Hilst 008f83d2e4 test(xCAT-test): add dhcptest, a wire-level DHCP client test tool
xCAT's DHCP behaviour is tested from two directions today, neither of which
touches the wire: xCAT-test/unit/dhcp_*.t assert on generated config text, and
xCAT-test/integration/dhcp_{isc,kea}_config_validation.t feed that config to a
real daemon and check it parses. Both stop at "the server accepted our
config". Nothing verifies that a client sending option 93 = 0x000b actually
gets an aarch64 loader back.

The one existing wire tool, xCAT-probe/subcmds/detect_dhcpd, hand-packs a
fixed DISCOVER carrying no option 60, 77 or 93 (so it never reaches any arch
branch), parses replies by regexing tcpdump output, and binds an
IO::Socket::INET to a local address, so it cannot run on a provisioning NIC
that has no address yet.

dhcptest fills that gap. It is a Python 3 tool using only the standard library
plus Scapy, speaking raw Layer 2, driving DHCP transactions declared in INI
files and asserting on what came back:

  dhcptest run      -i eth1 --set net=10.0.0.0/24 conf/full-lease.conf
  dhcptest validate conf/*.conf      # no root, no network, no scapy
  dhcptest list     conf/*.conf
  dhcptest discover -i eth1          # ad-hoc, no conf file

Scenarios cover DISCOVER/OFFER, the full lease, renew and rebind, reserved
versus pooled addresses, deliberate silence, the PXE architecture matrix and
the iPXE user-class split. Assertions are a small DSL -- target, operator,
value -- over message type, BOOTP header fields, options by number or name,
subnet membership, and the boot file a client would actually use (option 67
or the header, since servers differ on which they fill).

Two boundaries are enforced by unit test rather than by convention:

  - The tool is implementation-agnostic. It exchanges packets and checks
    fields; it never reads the xCAT database, never runs an xCAT command, and
    names no DHCP implementation. Anything that differs between servers is
    expressed by whoever writes the .conf.
  - Only runner.py imports scapy, so validate and list stay usable in CI on a
    host with neither scapy nor root.

Host networking is never modified. The client MAC defaults to a synthetic
locally-administered address, everything goes over a raw L2 socket, no leased
address is ever configured, and the ARP responder answers only for addresses
the session was actually granted.

Variables in .conf files are configparser's own BasicInterpolation, %(name)s,
fed from [vars] and --set. $offer.address and friends are resolved separately
at step-execution time, because they name a reply that has not arrived when
the file is read; BasicInterpolation gives $ no meaning, so the two coexist
without escaping.

Packaging and CI:

  - xCAT-test.spec installs dhcptest alongside unit/ and integration/, and
    only recommends python3-scapy: it lives in EPEL on EL, and a hard Requires
    would make xCAT-test uninstallable on a management node without EPEL.
    The deb depends on it outright.
  - github_action_xcat_test.pl runs the unit tests and `dhcptest validate`
    last, after the fast regression.
  - autotest/testcase/dhcptest/cases0 carries the two offline cases plus a
    wire case that stands down with an explanation when no provisioning NIC
    is available.

Verified against a real DHCP server in a network namespace: 34 lease, renew,
rebind, reservation and silence assertions and 22 PXE/iPXE assertions all
pass, and host networking is untouched before and after.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-10 08:19:41 -03:00
neo954 327db76f9e Make all the deb packages have the exactly same version and release numbers 2017-01-03 12:56:15 +08:00
xq2005 28d9fdd2aa change the Maintainer to xCAT when building packages on ubuntu
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16760 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-06-26 07:34:47 +00:00
adalbas 48c3e12220 add xcat-test build files for deb packages
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10754 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2011-10-12 15:39:05 +00:00