2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-26 01:34:05 +00:00
Files
xcat-core/xCAT-test/bats
Daniel Hilst a603b9d6c2 fix(xcat-core): otherpkgs sends the package manager output to syslog as one truncated message
The otherpkgs postscript passes the whole package manager transaction to logger as a single
message argument. rsyslog escapes every newline to #012 and cuts the message at 8 KiB, which
is where the Failed:, Error: and summary lines sit. A line that starts with -- is also read
as a logger option.

The seven sites in xCAT/postscripts/otherpkgs that log $result now pipe it to logger. logger
without a message argument reads standard input and sends one message per line.

postscripts_otherpkgs.bats drives the upgrade block and the two preremove blocks with logger
and the package manager shadowed, and counts the messages. Against the unfixed script the
three tests report one message where three are expected.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-14 15:49:07 -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.