aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing')
-rw-r--r--scripts/testing/tests/test_boot.py16
-rw-r--r--scripts/testing/tests/test_desktop.py29
-rw-r--r--scripts/testing/tests/test_packages.py49
3 files changed, 94 insertions, 0 deletions
diff --git a/scripts/testing/tests/test_boot.py b/scripts/testing/tests/test_boot.py
index 78b4404..e442682 100644
--- a/scripts/testing/tests/test_boot.py
+++ b/scripts/testing/tests/test_boot.py
@@ -65,3 +65,19 @@ def test_zfs_has_sanoid(host):
if not host.exists("zfs"):
pytest.skip("ZFS not installed (non-ZFS system)")
assert host.exists("sanoid"), "ZFS system should have sanoid installed"
+
+
+def test_zfs_pre_pacman_snapshot_hook(host):
+ # archsetup installs a PreTransaction pacman hook + a self-pruning script so
+ # every pacman transaction is preceded by a rollback snapshot (configure_
+ # pre_pacman_snapshots, run late in boot_ux). ZFS-root only.
+ if not host.exists("zfs"):
+ pytest.skip("ZFS not installed (non-ZFS system)")
+ script = host.file("/usr/local/bin/zfs-pre-snapshot")
+ assert script.exists and script.is_file, "pre-pacman snapshot script missing"
+ assert script.mode & 0o111, "pre-pacman snapshot script is not executable"
+ hook = host.file("/etc/pacman.d/hooks/zfs-snapshot.hook")
+ assert hook.exists and hook.is_file, "zfs-snapshot.hook missing"
+ assert "PreTransaction" in hook.content_string, "hook not PreTransaction"
+ assert "/usr/local/bin/zfs-pre-snapshot" in hook.content_string, \
+ "hook does not exec the snapshot script"
diff --git a/scripts/testing/tests/test_desktop.py b/scripts/testing/tests/test_desktop.py
index c02d2b6..6f79bfd 100644
--- a/scripts/testing/tests/test_desktop.py
+++ b/scripts/testing/tests/test_desktop.py
@@ -109,3 +109,32 @@ def test_autologin_configured(host):
if not conf.exists:
pytest.skip("autologin not configured (AUTOLOGIN=no, may be intentional)")
assert conf.exists
+
+
+BT_PANEL_BINS = ["bt", "bt-panel", "bt-priv", "waybar-bt"]
+
+
+@pytest.mark.attribution("archsetup")
+@pytest.mark.parametrize("name", BT_PANEL_BINS)
+def test_bt_panel_bin_stowed(host, hyprland_installed, home, name):
+ # Executable via either stow shape (per-file symlink or folded dir).
+ if not hyprland_installed:
+ pytest.skip("Hyprland not installed (DESKTOP_ENV != hyprland)")
+ path = "%s/.local/bin/%s" % (home, name)
+ assert host.file(path).exists, "%s missing from ~/.local/bin" % name
+ assert host.run("test -x %s" % path).rc == 0, "%s not executable" % name
+
+
+@pytest.mark.attribution("archsetup")
+def test_bt_panel_wired(host, hyprland_installed, home):
+ # A fresh install lands the panel reachable: bar module, keybind, css.
+ if not hyprland_installed:
+ pytest.skip("Hyprland not installed (DESKTOP_ENV != hyprland)")
+ waybar = host.file("%s/.config/waybar/config" % home)
+ assert "custom/bluetooth" in waybar.content_string, \
+ "waybar config lacks the custom/bluetooth module"
+ hyprconf = host.file("%s/.config/hypr/hyprland.conf" % home)
+ assert "bt-panel" in hyprconf.content_string, \
+ "hyprland.conf lacks the bt-panel keybind"
+ assert host.file("%s/.config/themes/dupre/panel.css" % home).exists, \
+ "shared panel css missing from the stowed theme"
diff --git a/scripts/testing/tests/test_packages.py b/scripts/testing/tests/test_packages.py
index f237088..e0387d6 100644
--- a/scripts/testing/tests/test_packages.py
+++ b/scripts/testing/tests/test_packages.py
@@ -58,3 +58,52 @@ def test_git_installed(host):
@pytest.mark.parametrize("tool", DEV_TOOLS)
def test_dev_tool_present(host, tool):
assert host.exists(tool), "dev tool %s missing from PATH" % tool
+
+
+BLUETOOTH_STACK = ["bluez", "bluez-utils"]
+VPN_STACK = ["wireguard-tools", "proton-vpn-cli", "tailscale"]
+
+
+@pytest.mark.attribution("archsetup")
+@pytest.mark.parametrize("pkg", BLUETOOTH_STACK)
+def test_bluetooth_stack_installed(host, pkg):
+ assert host.package(pkg).is_installed
+
+
+# bt panel replaced blueman; zoom-web replaced zoom; the net panel's Tunnels
+# view + proton-vpn-cli replaced the GTK app (they can't run concurrently).
+RETIRED_PACKAGES = ["blueman", "zoom", "proton-vpn-gtk-app"]
+
+
+@pytest.mark.attribution("archsetup")
+@pytest.mark.parametrize("pkg", RETIRED_PACKAGES)
+def test_retired_package_not_installed(host, pkg):
+ # A reappearance means an install step regressed.
+ assert not host.package(pkg).is_installed
+
+
+@pytest.mark.attribution("archsetup")
+@pytest.mark.parametrize("pkg", VPN_STACK)
+def test_vpn_stack_installed(host, pkg):
+ assert host.package(pkg).is_installed
+
+
+@pytest.mark.attribution("archsetup")
+def test_tailscale_operator_granted(host, target_user):
+ # The installer grants operator so the net panel can toggle tailscale
+ # without sudo. Prefs only answer when the daemon is up.
+ if not host.service("tailscaled").is_running:
+ pytest.skip("tailscaled not running")
+ out = host.run("tailscale debug prefs")
+ assert out.rc == 0, "tailscale debug prefs failed"
+ assert '"OperatorUser": "%s"' % target_user in out.stdout
+
+
+@pytest.mark.attribution("archsetup")
+def test_eask_installed_user_local(host, home):
+ # Installed via npm -g --prefix ~/.local as the user; chime and
+ # linear-emacs shell out to it.
+ f = host.file("%s/.local/bin/eask" % home)
+ assert f.exists, "eask missing from ~/.local/bin"
+ npmrc = host.file("%s/.npmrc" % home)
+ assert npmrc.exists, ".npmrc (user npm prefix) not stowed"