From 99a26d7de23bbfc757957c08e47606c3690df4cb Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 25 Jun 2026 00:54:53 -0400 Subject: test(archsetup): scaffold Testinfra post-install validation (P1) Stand up the Testinfra/pytest harness alongside the existing shell sweep so the two can be compared for parity before pytest takes over. Adds scripts/testing/tests/ (conftest with failure attribution markers, a report hook, and a target_user fixture, plus three parity checks: user, ufw, dotfiles) and scripts/testing/lib/testinfra.sh, which injects a throwaway SSH key into the VM and runs pytest over SSH. The sweep is advisory here (RUN_TESTINFRA toggle, non-fatal) and does not yet affect pass/fail. Pulls python-pytest and python-pytest-testinfra into make deps. Verified on the host: py_compile clean, pytest --collect-only green, bash -n and shellcheck clean. The sweep running against a real VM is verified by the next make test run. --- scripts/testing/tests/test_users.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/testing/tests/test_users.py (limited to 'scripts/testing/tests/test_users.py') diff --git a/scripts/testing/tests/test_users.py b/scripts/testing/tests/test_users.py new file mode 100644 index 0000000..92ce768 --- /dev/null +++ b/scripts/testing/tests/test_users.py @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +"""Post-install checks: the user account archsetup creates. + +Parity port of validate_user_created / validate_user_shell from validation.sh. +""" + +import pytest + + +@pytest.mark.smoke +@pytest.mark.attribution("archsetup") +def test_user_exists(host, target_user): + assert host.user(target_user).exists + + +@pytest.mark.attribution("archsetup") +def test_user_shell_is_zsh(host, target_user): + assert host.user(target_user).shell == "/usr/bin/zsh" -- cgit v1.2.3