The SELinux cases marked their audit window with date "+%H:%M:%S" and gave it to selinux_avc_check.sh. Two failures follow from the time window. The body of selinux_mn_labels runs inside one second, so an el9 run reported SEARCHED=0 and the guard called a quiet node a usage error. And ausearch -ts has one second of granularity, so the denials that the positive control of selinux_mn_labels creates on purpose landed in the window of selinux_restapi_avc, which failed with XCAT_AVC=2 on two httpd_t getattr records it did not cause. selinux_avc_check.sh takes a checkpoint file: --init consumes the records written so far and prints BASELINE, --since reports the denials after that point. A checkpoint is an offset, so an empty answer has one meaning and two cases cannot read one record. Each case opens its own checkpoint, and the positive control opens a second one, which also removes the sleep 1 that the granularity needed. The count refuses an answer that is neither a record nor '<no matches>', so an ausearch error message cannot read as a clean window. The -ts form stays for the keywords boot and today, and now asks for today's records before it calls an empty window a usage error. /xcatpost is reported and no longer asserted on a compute or service node. The kickstart relabel runs in %post, the xCAT post scripts write that tree at the first boot, and the node carries no xCAT-selinux, so a clean restorecon -Rnv there is not what the design promises. selinux_avc_check.bats fails 7 of its 15 checks without this change, on rome01. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
xCAT-test
Unit tests that run from the source checkout are split by implementation language:
| Test type | Location | Runner |
|---|---|---|
| Perl unit tests | xCAT-test/unit/*.t |
prove -r xCAT-test/unit |
| Shell unit tests | xCAT-test/bats/*.bats |
bats -r xCAT-test/bats |
| Black-box service tests | xCAT-test/blackboxtest/ |
python3 -m unittest discover -s tests, then blackboxtest run <conf> on a management node |
| Native host tests | xCAT-test/native/*.t, xCAT-test/native/*.bats |
Selected CI cases and explicit lab runs; see native/README.md |
| CLI functional tests | xCAT-test/autotest/testcase/ and xCAT-test/autotest/bundle/ |
xcattest -f <cluster.conf> -t <case> or xcattest -f <cluster.conf> -b <bundle> |
Use Perl .t tests for Perl modules, Perl scripts, templates, and repository
artifacts. Use BATS tests for shell-script behavior that can be exercised from
the checkout by sourcing a shell library or script and shadowing external
commands.
Shell behavior should not be tested by Perl tests that grep shell source. Put
those tests under xCAT-test/bats instead.
blackboxtest is the odd one out: its Python unit tests and blackboxtest validate run offline like the others, but its point is the third column --
asking a management node what a booting node asks (DHCP, DNS, TFTP, HTTP,
xcatd) and asserting on the answers. It talks to the services only as a client,
so it does not depend on which DHCP server answers or on the xCAT database.
See unit/README.md, bats/README.md and blackboxtest/README.md for the
detailed rules for each suite.