diff options
| author | Craig Jennings <c@cjennings.net> | 2026-07-18 19:46:05 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-07-18 19:46:05 -0500 |
| commit | 80017365527b612ca8763b29c5771fc41d58def5 (patch) | |
| tree | bd38eb5586a84dc22c55b502ca8b8caecf734f97 /tests/installer-steps/test_pacman_hook_order.py | |
| parent | bea3010992ba56f5b248638be6db78ff0b9132bb (diff) | |
| download | archsetup-80017365527b612ca8763b29c5771fc41d58def5.tar.gz archsetup-80017365527b612ca8763b29c5771fc41d58def5.zip | |
fix: order pacman safety hooks
Install snapshot and live-update hooks before mkinitcpio removal, migrate legacy paths, and cover the ordering invariant.
Diffstat (limited to 'tests/installer-steps/test_pacman_hook_order.py')
| -rw-r--r-- | tests/installer-steps/test_pacman_hook_order.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/installer-steps/test_pacman_hook_order.py b/tests/installer-steps/test_pacman_hook_order.py new file mode 100644 index 0000000..49acdbe --- /dev/null +++ b/tests/installer-steps/test_pacman_hook_order.py @@ -0,0 +1,27 @@ +"""Regression tests for the pacman hook ordering safety invariant.""" + +import os +import unittest + + +REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) +ARCHSETUP = os.path.join(REPO_ROOT, "archsetup") + + +class PacmanHookOrderTests(unittest.TestCase): + def test_safety_hooks_precede_mkinitcpio_removal(self): + with open(ARCHSETUP, encoding="utf-8") as source: + text = source.read() + + self.assertIn( + "cat << 'EOF' > /etc/pacman.d/hooks/05-zfs-snapshot.hook", text) + self.assertIn( + "cat > /etc/pacman.d/hooks/10-hypr-live-update-guard.hook", text) + self.assertLess("05-zfs-snapshot.hook", "60-mkinitcpio-remove.hook") + self.assertLess("10-hypr-live-update-guard.hook", "60-mkinitcpio-remove.hook") + self.assertIn("rm -f /etc/pacman.d/hooks/zfs-snapshot.hook", text) + self.assertIn("rm -f /etc/pacman.d/hooks/hypr-live-update-guard.hook", text) + + +if __name__ == "__main__": + unittest.main() |
