2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-20 14:45:41 +00:00
Files
xcat-core/xCAT-test/bats
Daniel Hilst dde7ebd97e test(xcat-core): an assertion about /run could not tell who wrote there
The error-command test ended with

    [ ! -e /run/testnode-logs.tar ]

meant to show the archive had not gone to the default path. It cannot show that.
The file may exist for reasons that have nothing to do with this test, in which case
the assertion fails while nothing is wrong; and its absence would be equally true if
the override had never worked at all. It answers a question about the host, not
about the run.

The positive assertion above it already carries the proof: the tar shadow writes a
marker, and the test greps for that marker in the path it passed. The output being
there is what shows the redirection went there.

Removing it changes nothing about what the test catches. With the override taken out
of the template, so the archive path is hard-coded again, the remaining assertion
still fails.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit f8618ce746)
2026-09-24 13:57:21 +00: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.