aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/tests/test_packages.py
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-25 01:12:35 -0400
committerCraig Jennings <c@cjennings.net>2026-06-25 01:12:35 -0400
commit3cac3b3dfcd432395201a309920c2491ee9caf01 (patch)
tree45c3ea7f8b73f7375c484912ecadc8a65c4d88a5 /scripts/testing/tests/test_packages.py
parent99a26d7de23bbfc757957c08e47606c3690df4cb (diff)
downloadarchsetup-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/test_packages.py')
-rw-r--r--scripts/testing/tests/test_packages.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/scripts/testing/tests/test_packages.py b/scripts/testing/tests/test_packages.py
new file mode 100644
index 0000000..f237088
--- /dev/null
+++ b/scripts/testing/tests/test_packages.py
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+"""Post-install checks: package managers and key packages.
+
+Parity port of validate_yay_installed, validate_pacman_working,
+validate_terminus_font, validate_emacs, validate_git_config, validate_dev_tools.
+"""
+
+import pytest
+
+
+DEV_TOOLS = ["python", "node", "npm", "go", "rustc"]
+
+
+@pytest.mark.smoke
+@pytest.mark.attribution("archsetup")
+def test_yay_installed(host):
+ assert host.exists("yay"), "yay binary not on PATH"
+
+
+@pytest.mark.attribution("archsetup")
+def test_yay_functional(host, target_user):
+ # yay must actually query the package DB as the user, not just exist.
+ assert host.run("sudo -u %s yay -Qi yay" % target_user).rc == 0
+
+
+@pytest.mark.smoke
+@pytest.mark.attribution("unknown")
+def test_pacman_functional(host):
+ assert host.package("base").is_installed
+
+
+@pytest.mark.attribution("archsetup")
+def test_terminus_font_installed(host):
+ assert host.package("terminus-font").is_installed
+
+
+@pytest.mark.attribution("archsetup")
+def test_emacs_installed(host):
+ assert host.exists("emacs")
+
+
+@pytest.mark.attribution("archsetup")
+def test_emacs_config_readable_by_user(host, target_user, home):
+ emacsd = host.file("%s/.emacs.d" % home)
+ if not emacsd.exists:
+ pytest.skip(".emacs.d not present (config dir optional on some profiles)")
+ assert emacsd.is_directory
+ assert host.run("sudo -u %s ls %s" % (target_user, emacsd.path)).rc == 0
+
+
+@pytest.mark.smoke
+@pytest.mark.attribution("archsetup")
+def test_git_installed(host):
+ assert host.exists("git")
+
+
+@pytest.mark.attribution("archsetup")
+@pytest.mark.parametrize("tool", DEV_TOOLS)
+def test_dev_tool_present(host, tool):
+ assert host.exists(tool), "dev tool %s missing from PATH" % tool