summaryrefslogtreecommitdiff
path: root/t/001-deb-systemd-helper.t
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2013-09-19 02:34:12 +0000
committerMichael Stapelberg <michael@stapelberg.de>2013-09-19 02:34:12 +0000
commit557100573c4c0d68f6d3e82c593c4da751ce7818 (patch)
tree88cd021b55fbe3607f229f849e36365d7263161e /t/001-deb-systemd-helper.t
parent2b6898672734111c046208b687c45692a2a6eadd (diff)
downloadinit-system-helpers-debian/1.10.tar.gz
Store masked state to respect user’s maskingdebian/1.10
We cannot just unconditionally unmask services on installation time, otherwise “systemctl mask” executed by the user will be reversed. To that end, files in /var/lib/systemd/deb-systemd-helper-masked/ signal that d-s-h masked the service and is allowed to unmask it.
Diffstat (limited to 't/001-deb-systemd-helper.t')
-rw-r--r--t/001-deb-systemd-helper.t17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/001-deb-systemd-helper.t b/t/001-deb-systemd-helper.t
index 5bb9ecd..4d814ea 100644
--- a/t/001-deb-systemd-helper.t
+++ b/t/001-deb-systemd-helper.t
@@ -191,4 +191,21 @@ is(readlink($mask_path), '/dev/null', 'service masked');
$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
ok(! -e $mask_path, 'symlink no longer exists');
+# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
+# ┃ Verify “mask”/unmask don’t do anything when the user already masked. ┃
+# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
+
+ok(! -l $mask_path, 'mask link does not exist yet');
+symlink('/dev/null', $mask_path);
+ok(-l $mask_path, 'mask link exists');
+is(readlink($mask_path), '/dev/null', 'service masked');
+
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit");
+ok(-l $mask_path, 'mask link exists');
+is(readlink($mask_path), '/dev/null', 'service still masked');
+
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
+ok(-l $mask_path, 'mask link exists');
+is(readlink($mask_path), '/dev/null', 'service still masked');
+
done_testing;