diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2013-09-15 04:20:35 +0000 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2013-09-15 04:20:35 +0000 |
commit | 9c1373f308d77d4dfaf7f644591facbe1e6825c3 (patch) | |
tree | 4955b38e18b270075c373e37b70354201c8b7ccd /t | |
parent | 73d6f8a2143f3af90bc229eef8d7cb091f160a03 (diff) | |
download | init-system-helpers-9c1373f308d77d4dfaf7f644591facbe1e6825c3.tar.gz |
d-s-h: implement mask and unmask commands
Diffstat (limited to 't')
-rw-r--r-- | t/001-deb-systemd-helper.t | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/t/001-deb-systemd-helper.t b/t/001-deb-systemd-helper.t index c27408c..9c1773f 100644 --- a/t/001-deb-systemd-helper.t +++ b/t/001-deb-systemd-helper.t @@ -164,4 +164,39 @@ $retval = system("DPKG_MAINTSCRIPT_PACKAGE=test _DEB_SYSTEMD_HELPER_PURGE=1 $dsh isnt_enabled($random_unit); +# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +# ┃ Verify “enable” after purging does re-create the symlinks. ┃ +# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +ok(! -l $symlink_path, 'symlink does not exist yet'); +isnt_enabled($random_unit); + +$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit"); + +is_enabled($random_unit); +is_debian_installed($random_unit); + +# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +# ┃ Verify “mask” (when enabled) results in the symlink pointing to /dev/null ┃ +# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit"); +is(readlink($symlink_path), '/dev/null', 'service masked'); + +$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit"); +isnt(readlink($symlink_path), '/dev/null', 'service no longer masked'); + +# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +# ┃ Verify “mask” (when disabled) works the same way ┃ +# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh disable $random_unit"); +ok(! -e $symlink_path, 'symlink no longer exists'); + +$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit"); +is(readlink($symlink_path), '/dev/null', 'service masked'); + +$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit"); +ok(! -e $symlink_path, 'symlink no longer exists'); + done_testing; |