]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test logind restart
authorMatteo Croce <teknoraver@meta.com>
Wed, 2 Apr 2025 19:18:45 +0000 (21:18 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Apr 2025 23:55:21 +0000 (08:55 +0900)
Add a simple check which ensures that a user service survives
a logind restart.

test/units/TEST-35-LOGIN.sh

index 5a83b5847a18fe7a3b2cb8b36f1f28446737892f..d10bb93b4fda3dcb0a25def1e83f58801f0d53a3 100755 (executable)
@@ -785,6 +785,20 @@ testcase_varlink() {
     varlinkctl introspect /run/systemd/io.systemd.Login
 }
 
+testcase_restart() {
+    local UNIT
+
+    UNIT=user-sleeper.service
+
+    systemd-run --service-type=notify run0 -u logind-test-user --unit="$UNIT" sleep infinity
+    systemctl restart systemd-logind
+
+    systemctl --quiet is-active "$UNIT"
+    loginctl | grep logind-test-user | grep -qw background
+
+    systemctl kill "$UNIT"
+}
+
 setup_test_user
 test_write_dropin
 run_testcases