From 6257cfd653f76d5a299caf26680366a9f53d0ae0 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Thu, 23 Jul 2026 11:47:15 -0300 Subject: [PATCH] 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 764e667e0a3307fe7cabb836785e9f338f555955) --- xCAT-test/autotest/testcase/integration/cases0 | 1 + xCAT-test/integration/README.md | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/xCAT-test/autotest/testcase/integration/cases0 b/xCAT-test/autotest/testcase/integration/cases0 index a327ccffd..a3319a20a 100644 --- a/xCAT-test/autotest/testcase/integration/cases0 +++ b/xCAT-test/autotest/testcase/integration/cases0 @@ -4,4 +4,5 @@ os:Linux label:mn_only,ci_test,integration cmd:prove -I/opt/xcat/lib/perl -I/opt/xcat/lib/perl/xCAT -r /opt/xcat/share/xcat/tools/autotest/integration check:rc==0 +check:output=~Files=3 end diff --git a/xCAT-test/integration/README.md b/xCAT-test/integration/README.md index b30e5ee35..5b2ae6df5 100644 --- a/xCAT-test/integration/README.md +++ b/xCAT-test/integration/README.md @@ -27,6 +27,14 @@ against it. Note the `-I` flags: unlike the unit tests these run from the installed location, so they pick up xCAT modules from `/opt/xcat/lib/perl` rather than from a source tree. +The case checks `rc==0` and `output=~Files=3`. The second assertion is there because +`prove` exits 0 both when tests pass and when they all skip, so `rc==0` alone would let +the case report green having run nothing. Matching `Files=3` proves `prove` actually +found all three files, which catches a packaging regression or a file being renamed +without the count being updated here. **Add to that number when you add a test.** A +missing directory is already caught by `rc==0` -- `prove -r` on a path that does not +exist exits 2. + Note also that `github_action_xcat_test.pl` invokes each case through `sudo`, so in CI these tests run as **root** while the unit tests run unprivileged. That is the right way round -- integration tests legitimately need to write to places like `/etc/kea`,