2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-25 17:24:07 +00:00
Files
xcat-core/xCAT-test/bats
Daniel Hilst 9c2e733b99 fix(xcatdsklspost): the diskful cleanup deleted a diskless node's postscripts
site.cleanupdiskfullxcatpost names the node type it applies to, and site.5.rst
says "on the diskfull nodes". xcatdsklspost serves every type: updatenode calls
it for a diskless or statelite node as well, and the site value is one row that
reaches all of them. With cleanupdiskfullxcatpost=yes and cleanupxcatpost=no,
append_xcatpost_cleanup still appended the delete for those nodes.

The diskful branch now reads NODESETSTATE from the generated mypostscript and
appends nothing for netboot or statelite. That is the signal remoteshell,
hardeths, configeth, otherpkgs and servicenode already use for this question,
and mypostscript.tmpl exports it.

cleanupxcatpost is unchanged. It names no node type and keeps applying to every
one, which xcatdsklspost_xcatpost_cleanup.bats now asserts so a guard added to
the wrong branch shows up.

Four cases cover it: a netboot node and a statelite node keep their postscripts,
a diskful node is still cleaned, and cleanupxcatpost still empties a netboot
node. The first two fail against the parent commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-23 10:07:16 -03:00
..

xCAT-test/bats

Shell-script unit tests live here and run with:

bats -r xCAT-test/bats

The GitHub Actions xcat_test workflow runs this command after the Perl .t unit tests. Use BATS for shell behavior that can be exercised from the source tree without an installed xCAT, a live management node, or real services.

Prefer sourcing an existing shell library or sourceable script and calling the function under test. Keep reusable install-template helpers in xCAT-server/share/xcat/install/scripts/scriptlib, and reusable postscript helpers in xCAT/postscripts/xcatlib.sh. Use scratch directories and shadowed commands so tests cannot write to the host.

Extraction helpers in helpers/shell_source.bash are only for legacy code that cannot safely be sourced yet. Do not add Perl .t tests that grep shell source when the behavior can be tested with BATS.