2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-22 15:48:14 +00:00
Files
xcat-core/xCAT-test/provtest/tests/context.py
T
Daniel Hilst 86533527e0 test(provtest): unit-test the offline half, and the rules it relies on
154 tests, standard library only, no network and no root: the config parser,
the assertion language, $step.field resolution, the offline machine, TAP
output, address arithmetic, and the decoding of captured dig, curl and tftp
output -- including an NXDOMAIN whose only record is an SOA, and a TFTP fetch
that created an empty file before finding the server had nothing to send.

test_boundaries.py asserts rules about this code rather than about xCAT: only
proc.py starts a process, no module opens a database or names an xCAT command,
and no step type can run one. A suite that asked xCAT what to expect would
pass on a cluster that could not boot a node.
2026-09-11 08:04:31 -03:00

33 lines
971 B
Python

"""Put `src/` on the path so the tests import the tool, not an installed copy.
The suite runs out of a checkout with no install step, so the import has to be
made to work rather than assumed. Every test module imports this one first.
"""
import os
import sys
TESTS = os.path.dirname(os.path.realpath(__file__))
ROOT = os.path.dirname(TESTS)
SRC = os.path.join(ROOT, "src")
LIB = os.path.join(SRC, "provtest_lib")
CONF = os.path.join(ROOT, "conf")
if SRC not in sys.path:
sys.path.insert(0, SRC)
def conf_files():
"""Every shipped scenario file, sorted."""
return sorted(os.path.join(CONF, name) for name in os.listdir(CONF)
if name.endswith(".conf"))
def modules():
"""Every module of the tool, as `(name, path)`."""
found = [("provtest", os.path.join(SRC, "provtest"))]
for name in sorted(os.listdir(LIB)):
if name.endswith(".py"):
found.append((name[:-3], os.path.join(LIB, name)))
return found