diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-25 01:12:35 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-25 01:12:35 -0400 |
| commit | 3cac3b3dfcd432395201a309920c2491ee9caf01 (patch) | |
| tree | 45c3ea7f8b73f7375c484912ecadc8a65c4d88a5 /scripts/testing/tests/conftest.py | |
| parent | 99a26d7de23bbfc757957c08e47606c3690df4cb (diff) | |
| download | archsetup-3cac3b3dfcd432395201a309920c2491ee9caf01.tar.gz archsetup-3cac3b3dfcd432395201a309920c2491ee9caf01.zip | |
test(archsetup): port full shell validation sweep to Testinfra (P2)
Port all ~26 post-install checks from validation.sh to pytest/Testinfra,
reaching parity before the cutover. Adds test_users, test_packages,
test_services, test_desktop, test_boot, test_keyring, and test_archsetup
(88 tests after parametrizing groups, services, timers, tools, and configs),
plus shared conftest fixtures for ZFS/NVMe/compositor/networking gating.
The shell sweep's three outcomes map cleanly: hard failures become assertions,
advisory warnings and unmet preconditions (headless compositor, slirp
networking, optional services, non-ZFS/non-NVMe hosts) become skips.
One correctness fix vs the shell sweep: check awww, not swww — archsetup
installs awww (swww's successor) and `pacman -Q swww` no longer matches.
Verified on the host: py_compile clean, pytest --collect-only green (88 tests).
The sweep against a real VM is verified by the make test run that follows.
Diffstat (limited to 'scripts/testing/tests/conftest.py')
| -rw-r--r-- | scripts/testing/tests/conftest.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/testing/tests/conftest.py b/scripts/testing/tests/conftest.py index 00632b6..c805de9 100644 --- a/scripts/testing/tests/conftest.py +++ b/scripts/testing/tests/conftest.py @@ -70,3 +70,42 @@ def pytest_sessionfinish(session, exitstatus): def target_user(): """The account archsetup created in the VM under test.""" return os.environ.get("ARCHSETUP_TEST_USER", "cjennings") + + +@pytest.fixture(scope="session") +def home(target_user): + return "/home/%s" % target_user + + +@pytest.fixture(scope="session") +def zfs_root(host): + """True when the VM's root filesystem is ZFS (gates ZFS-specific checks).""" + return host.run("findmnt -n -o FSTYPE /").stdout.strip() == "zfs" + + +@pytest.fixture(scope="session") +def has_nvme(host): + """True when the VM exposes an NVMe device.""" + return host.run("ls /dev/nvme0n1 2>/dev/null").rc == 0 + + +@pytest.fixture(scope="session") +def hyprland_installed(host): + return host.package("hyprland").is_installed + + +@pytest.fixture(scope="session") +def dwm_installed(host): + return host.file("/usr/local/bin/dwm").exists + + +@pytest.fixture(scope="session") +def compositor_running(host): + """A graphical session is live (gates socket/portal checks that need one).""" + return host.run("pgrep -x Hyprland").rc == 0 + + +@pytest.fixture(scope="session") +def on_slirp(host): + """QEMU user-mode networking (10.0.2.x) — no multicast, so mDNS can't work.""" + return "10.0.2." in host.run("ip -4 addr show").stdout |
