summaryrefslogtreecommitdiffstats
path: root/test/units/testsuite-07.issue-3166.sh
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2023-05-10 13:49:34 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2023-05-10 14:29:38 +0200
commit33dff897b9ad1e24b2c737de1e41b21c4543c8e1 (patch)
tree62e1dc65b42b475c5dfa649083a6ac95fd2065c5 /test/units/testsuite-07.issue-3166.sh
parenttest: merge TEST-10-ISSUE-2467 with TEST-07-PID1 (diff)
downloadsystemd-33dff897b9ad1e24b2c737de1e41b21c4543c8e1.tar.xz
systemd-33dff897b9ad1e24b2c737de1e41b21c4543c8e1.zip
test: merge TEST-11-ISSUE-3166 into TEST-07-PID1
Diffstat (limited to 'test/units/testsuite-07.issue-3166.sh')
-rwxr-xr-xtest/units/testsuite-07.issue-3166.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/units/testsuite-07.issue-3166.sh b/test/units/testsuite-07.issue-3166.sh
new file mode 100755
index 0000000000..6677901358
--- /dev/null
+++ b/test/units/testsuite-07.issue-3166.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+set -o pipefail
+
+# Service doesn't enter the "failed" state
+# Issue: https://github.com/systemd/systemd/issues/3166
+
+systemctl --no-block start issue3166-fail-on-restart.service
+active_state="$(systemctl show --value --property ActiveState issue3166-fail-on-restart.service)"
+while [[ "$active_state" == "activating" || "$active_state" =~ ^(in)?active$ ]]; do
+ sleep .5
+ active_state="$(systemctl show --value --property ActiveState issue3166-fail-on-restart.service)"
+done
+systemctl is-failed issue3166-fail-on-restart.service || exit 1
+[[ "$(systemctl show --value --property NRestarts issue3166-fail-on-restart.service)" -le 3 ]] || exit 1