From 3ad3ee8e5454c6a82dd984f2003c56058d0e56df Mon Sep 17 00:00:00 2001 From: Matteo Croce Date: Wed, 2 Apr 2025 21:18:45 +0200 Subject: [PATCH] test logind restart Add a simple check which ensures that a user service survives a logind restart. --- test/units/TEST-35-LOGIN.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/units/TEST-35-LOGIN.sh b/test/units/TEST-35-LOGIN.sh index 5a83b5847a1..d10bb93b4fd 100755 --- a/test/units/TEST-35-LOGIN.sh +++ b/test/units/TEST-35-LOGIN.sh @@ -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 -- 2.47.3