2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-08-03 07:57:00 +00:00
Commit Graph

27180 Commits

Author SHA1 Message Date
Vinícius Ferrão a8ddda0efa test(kea): harden live Control Agent smoke
(cherry picked from commit 1034752080)
2026-07-26 11:34:15 +00:00
Vinícius Ferrão 135f14d1a3 test(kea): preserve named configuration group selection
(cherry picked from commit d155509345)
2026-07-26 11:34:15 +00:00
Vinícius Ferrão d96b59d276 refactor(kea): centralize service account lookup
(cherry picked from commit a44e9fd819)
2026-07-26 11:34:15 +00:00
Vinícius Ferrão 2e56a4ca91 test(dhcp): cover Kea control socket paths
(cherry picked from commit 5c3bb1d9fa)
2026-07-26 11:34:15 +00:00
Vinícius Ferrão c8baebe267 fix(dhcp): reuse Kea control socket paths
(cherry picked from commit 543eab3bdc)
2026-07-26 11:34:15 +00:00
Vinícius Ferrão ea71e73ada Merge pull request #7686 from VersatusHPC/backport-7650-to-2.18
[Backport 2.18] fix(xcat-core): run every *.t test in the GitHub CI
2026-07-25 01:19:20 -03:00
xcat2-backport-automation[bot] 9a2fa44087 Merge pull request #7689 from xcat2/backport-7629-to-2.18
[Backport 2.18] fix(template): fall back to $::XCATROOT when XCATROOT is not in %ENV
2026-07-24 22:04:18 +00:00
xcat2-backport-automation[bot] 233344ad7b Merge pull request #7688 from xcat2/backport-7630-to-2.18
[Backport 2.18] fix(networks): make IPv6 route filtering in donets() robust
2026-07-24 22:02:10 +00:00
xcat2-backport-automation[bot] 4ae707724e Merge pull request #7687 from xcat2/backport-7632-to-2.18
[Backport 2.18] fix(nodech): support comma-delimited values in the ,= and ^= operators
2026-07-24 21:54:59 +00:00
Vinícius Ferrão 37588da046 fix(template): preserve explicit XCATROOT values
(cherry picked from commit a64b6c647e)
2026-07-24 21:46:13 +00:00
Vinícius Ferrão 1fbc92ddf0 fix(template): fall back to $::XCATROOT when XCATROOT is not in %ENV
envvar() resolves a template variable purely from %ENV, so a template that
references $XCATROOT expands to an empty string whenever XCATROOT is not
present in the environment of the process doing the substitution. $::XCATROOT
is set as a package global at module load and is reliably available, so use it
for that one variable before falling back to %ENV.

Recovered from the unmerged lenovobuild branch (original da72c6b8).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
(cherry picked from commit 34866ebc23)
2026-07-24 21:46:13 +00:00
Vinícius Ferrão 83c8a56855 fix(test): load the installed networks plugin
(cherry picked from commit 3aff408657)
2026-07-24 21:44:32 +00:00
Vinícius Ferrão 2097bec822 fix(networks): validate IPv6 route filtering
(cherry picked from commit f8548ceeb9)
2026-07-24 21:44:32 +00:00
Vinícius Ferrão 39b78db3e8 fix(networks): skip nexthop and default lines when parsing IPv6 routes
`ip -6 route` output for ECMP/multipath routes carries `nexthop` continuation
lines, and a `default` route has no network prefix. donets() treated both as
networks and added bogus entries to the networks table. Skip them alongside
the existing link-local/unreachable/via/lo filtering.

Recovered from the unmerged lenovobuild branch (original 7094ba0c).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
(cherry picked from commit c97e973f36)
2026-07-24 21:44:32 +00:00
Vinícius Ferrão 96484651b9 fix(networks): exclude every link-local address from the networks table
donets() only skips the exact address 'fe80::/64' when scanning routes, so a
link-local route with any other prefix (e.g. a longer fe80:: subnet) is added
to the networks table as a bogus network. Match any fe80:: prefix instead of
the single literal value.

Recovered from the unmerged lenovobuild branch (original 8b79cf85).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
(cherry picked from commit d2be0c3865)
2026-07-24 21:44:32 +00:00
Vinícius Ferrão eed45bee6b test(nodech): cover comma-delimited group updates
(cherry picked from commit 25c9fb3836)
2026-07-24 21:42:07 +00:00
Vinícius Ferrão 967560180c fix(nodech): support multiple groups in the ^= operator
nodech's ^= operator removed only a single literal value, so
"nodech n1 groups^=a,b" tried to strip the combined string "a,b" and left the
individual groups in place. Split the value on commas and remove each piece.

Recovered from the unmerged lenovobuild branch (original 95c78b33).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
(cherry picked from commit f71ddef6ba)
2026-07-24 21:42:07 +00:00
Vinícius Ferrão 24f95a98b2 fix(nodech): handle comma-delimited values in the ,= operator
nodech's ,= operator appended the whole right-hand side as one value, so
"nodech n1 groups,=a,b" added the literal "a,b" and its duplicate check only
compared against that combined string. Split the value on commas and add each
piece individually, skipping any already present.

Recovered from the unmerged lenovobuild branch (original 086b0c0d).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
(cherry picked from commit 6e33661fc0)
2026-07-24 21:42:07 +00:00
Daniel Hilst daa070fb07 fix(xcat-core): allow naming cases whose output survives a pass
run_fast_regression_test() prints a case's output only when it fails.
For 250 cases that is the right default, but it leaves no way to tell
whether a passing case did real work or skipped everything. That is not
academic for cases wrapping prove: prove exits 0 both when tests pass
and when every test skips, so integration_tests reports green either
way and the log cannot distinguish them.

Add @verbose_cases. A case named there has its output printed on a pass
as well, and the failure branch no longer prints a second copy. Seed it
with integration_tests to find out which of the three integration tests
actually run on a runner -- in particular whether
dhcp_kea_config_validation.t validates from /etc/kea now that the case
runs as root, or still skips. Emptying the list restores the previous
behaviour exactly.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 53e2b0bd7b)
2026-07-24 12:56:58 -03:00
Daniel Hilst 6257cfd653 fix(xcat-core): assert the integration case actually ran its tests
The case gated only on rc==0, but prove exits 0 both when tests pass and
when every test skips, so the case could report green having run nothing
at all. That is not hypothetical: all three tests carry environment
guards, and on the pull request run the harness discards a passing
case's output, so there was no way to tell from the log whether anything
had executed.

Add check:output=~Files=3, which proves prove found all three files. It
still tolerates a legitimate skip on a node without Kea, and it catches
a packaging regression or a rename. A missing directory was already
caught, since prove -r on a nonexistent path exits 2.

The count has to be maintained by hand when tests are added here, which
the README now says.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 764e667e0a)
2026-07-24 12:56:58 -03:00
Daniel Hilst a12b6cad45 fix(xcat-core): run the integration testcase on pull requests too
The integration testcase was added without the ci_test label on the
grounds that the pull request workflow has no management node. That was
wrong: github_action_xcat_test.pl builds xCAT, installs it, runs
setup-local-client.sh and chtab, and leaves xcatd running, which makes
the runner a single node management node. Running the ci_test cases
against it is exactly what the fast regression stage already does.

Label the case ci_test so the integration tests get pull request
coverage as well. This also unlocks a test that had been skipping for a
fixable reason: each case is invoked through sudo, and
dhcp_kea_config_validation.t skips only because /etc/kea is not writable
by the unprivileged runner user, so as root it validates instead of
skipping.

Running the integration suite as root and the unit suite unprivileged 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.

Correct both READMEs, which carried the mistaken claim that the
integration tests do not run in CI.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit de17401338)
2026-07-24 12:56:58 -03:00
Daniel Hilst fbc8fad78d fix(xcat-core): split the source-only unit tests from the MN integration tests
Three of the files under xCAT-test/unit are not unit tests. They need an
installed management node rather than a checkout: copycds_packages_integrity.t
wants an /install populated by a real copycds, dhcp_kea_config_validation.t
wants a kea-dhcp4 binary that can read the config it generates, and
dhcp_kea_control_agent_smoke.t wants live kea-dhcp4 and kea-ctrl-agent
daemons running as root.

On a GitHub runner none of that exists, so all three plan skip_all. They were
the only three files skipping in the pull request run, which is not a
coincidence -- the skip is the symptom of them being filed in the wrong place.
A skipped test reports neither pass nor fail, so leaving them mixed in with
the unit tests trains the reader to scroll past skips in a directory where a
skip should mean something is wrong.

Move them to xCAT-test/integration, ship that directory alongside unit in
both the rpm and the deb, and drive it from a new xcattest testcase that
proves the installed copy on an MN. The case is deliberately not labelled
ci_test: the pull request workflow has no management node and must not pick
it up. check:rc==0 is the right gate for it -- prove exits non-zero on a real
failure, exits 0 when a test legitimately skips on a node without Kea, and
exits 2 if the directory is missing entirely, so a packaging regression still
fails the case.

Add a README.md to each directory recording which side of the line a new test
belongs on and how each suite is run.

xCAT-test/unit is now 44 files and 802 assertions with no skips at all; the
assertion count is unchanged, confirming the three moved files were
contributing nothing but skips.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 6ab9aca0b7)
2026-07-24 12:56:57 -03:00
Daniel Hilst d48640ac52 fix(xcat-core): keep a source tree for the unit tests to run against
The unit test stage failed on the first CI run with

    Cannot detect source of 'xCAT-test/unit/*.t'
    Files=0, Tests=0
    Result: NOTESTS

the glob reached prove unexpanded because it matched nothing. The source
tree is gone by the time the tests run: build-ubunturepo sets

    local_core_repo_path="$curdir/../../xcat-core"

and rm -rf's it before creating the apt repository there. GitHub checks
out into work/<repo>/<repo>, so for /home/runner/work/xcat-core/xcat-core
that path resolves to the checkout's own parent and the build wipes the
checkout, leaving an empty directory of the same name behind. The cd
still succeeds, which is why prove was handed a literal glob rather than
failing outright. This is also why every testcase that predates this
change proves /opt/xcat/share/xcat/tools/autotest/unit: after the build
the installed copy is the only one left.

Copy the checkout aside in preserve_source_tree() before the build and
prove that copy, so FindBin still resolves to a real source tree. Switch
to `prove -r xCAT-test/unit` as well, so a missing directory fails loudly
instead of silently degrading to a no-op the way an unmatched glob does.

Reproduced and verified by replaying the build under GitHub's directory
layout: the checkout drops to 0 test files, the preserved copy keeps all
47 and proves clean.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 63505793db)
2026-07-24 12:56:57 -03:00
Daniel Hilst 7fe2244d9d fix(xcat-core): run every xCAT-test unit test in the GitHub CI
The 47 test files under xCAT-test/unit/ were shipped but almost never
executed on a pull request. Only three hand-written xcattest cases
reached them -- dhcp_unit, ipmi_unit and xcatprobe_unit -- and each
proved a single glob against the installed copy, so the majority of the
suite had never run at all. Real drift went unnoticed as a result:
ubuntu_subiquity_template.t still asserted the pre-86e77bcd7 shape of
compute.subiquity.tmpl and failed against the current template.

Run `prove xCAT-test/unit/*.t` directly from github_action_xcat_test.pl.
The tests resolve xCAT modules and fixture files relative to the repo
root through FindBin, so they must be proved from the checkout and not
from /opt/xcat/share/xcat/tools/autotest/unit; install_xcat() chdir's
away, hence the getcwd() captured up front. The step runs after the
install because the suite needs the perl dependencies xCAT pulls in
(Net::DNS, XML::Simple) and a usable xCAT database.

Drop the three prove testcases so their tests do not run twice, and
refresh the two stale ubuntu_subiquity_template.t assertions: the
identity section is now intentional (86e77bcd7) and the MAC
normalization gained cut filters ahead of the tr (c6e38483f), which the
loosened regex plus a new assertion for the suffix stripping now cover.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit a0d2322b71)
2026-07-24 12:56:39 -03:00
xcat2-backport-automation[bot] 36823339b3 Merge pull request #7685 from xcat2/backport-7614-to-2.18
[Backport 2.18] fix(packaging): preserve xcatd init state across RPM transactions
2026-07-24 15:43:33 +00:00
xcat2-backport-automation[bot] bc04302b21 Merge pull request #7684 from xcat2/backport-7606-to-2.18
[Backport 2.18] refactor(dbobjutils): reuse only-if matcher for table routing
2026-07-24 15:42:32 +00:00
xcat2-backport-automation[bot] 8bcc00024a Merge pull request #7683 from xcat2/backport-7617-to-2.18
[Backport 2.18] fix(dhcp): avoid infinite loop building IPv6 reverse zones
2026-07-24 15:26:29 +00:00
Vinícius Ferrão 0c5cad78cf test(packaging): cover shared systemctl guard
(cherry picked from commit 6c26a10863)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 12755bcac0 refactor(packaging): share systemctl readiness guard
(cherry picked from commit ef6e037366)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão f644b39581 test(packaging): cover fresh legacy defaults
(cherry picked from commit 3505c24040)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão a5315d5f78 fix(packaging): preserve fresh legacy defaults
(cherry picked from commit 09d1befb62)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão d19bd15beb test(packaging): prepare fresh legacy defaults
(cherry picked from commit 0826a6b1ad)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 18f32cf648 test(packaging): cover custom SysV runlevels
(cherry picked from commit 9091b3f598)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão acd29fd40f fix(packaging): preserve custom SysV runlevels
(cherry picked from commit bdbf7b894a)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão a6873779ee test(packaging): cover legacy upgrade edge cases
(cherry picked from commit 7f44bd51bf)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 2d4b691b05 fix(packaging): preserve unregistered legacy state
(cherry picked from commit 7df7da59b3)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 4ae36a4d5c test(packaging): prepare legacy state resolution
(cherry picked from commit 9bff441795)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 3f45307350 test(packaging): cover managed xcatd init scripts
(cherry picked from commit 4efcd5132b)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão db4c51dfed fix(packaging): preserve unmanaged xcatd init scripts
(cherry picked from commit 115c9cda7e)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 096d9284c3 test(packaging): prepare managed init ownership
(cherry picked from commit 11709a2221)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 5a4826ecc0 test(packaging): cover RPM init transitions
(cherry picked from commit 11f9cada05)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão ba8cdc6871 fix(packaging): converge xcatd init transitions
(cherry picked from commit a47e73dc46)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 6e4f920b30 test(packaging): cover shared init management
(cherry picked from commit 5a9c32e885)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão e12f41aa9c refactor(packaging): centralize xcatd init management
(cherry picked from commit 5495f133e8)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 1198dec568 test(packaging): allow shared init state detection
(cherry picked from commit 6d7de3a927)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão c21b860059 test(packaging): cover hybrid init targets
(cherry picked from commit 002634ef6b)
2026-07-24 15:25:45 +00:00
Vinícius Ferrão 557913693c fix(packaging): expose explicit init target detection
(cherry picked from commit 8489e15969)
2026-07-24 15:25:45 +00:00
xcat2-backport-automation[bot] ce8a11eb6d Merge pull request #7682 from xcat2/backport-7618-to-2.18
[Backport 2.18] fix(NetworkUtils): guard formatNetmask against an undefined mask
2026-07-24 15:24:50 +00:00
Vinícius Ferrão c876bbf790 test(dbobjutils): cover literal only-if routing
(cherry picked from commit 8a4fe18cbf)
2026-07-24 15:24:33 +00:00
Vinícius Ferrão c77e30fe52 refactor(dbobjutils): reuse only-if matcher for table routing
(cherry picked from commit fd32ae6860)
2026-07-24 15:24:33 +00:00