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 | be2277d0db1afa06c1a1ab468f70b34c8d98e0a1 (patch) | |
| tree | bd38eb5586a84dc22c55b502ca8b8caecf734f97 /tests | |
| parent | cc358cffc4d02946a8e6fb649219443f40cee782 (diff) | |
| download | archsetup-be2277d0db1afa06c1a1ab468f70b34c8d98e0a1.tar.gz archsetup-be2277d0db1afa06c1a1ab468f70b34c8d98e0a1.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')
| -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() |
