summaryrefslogtreecommitdiffstats
path: root/test/units
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2020-06-10 10:18:00 +0200
committerLennart Poettering <lennart@poettering.net>2020-06-10 17:12:55 +0200
commitbb9244781c6fc7608f7cac910269f8987b8adc01 (patch)
tree2630b820bf9736e62c07a76cf231b2bd1c828925 /test/units
parentdocs: Change suffix for desktop applications to support non-transient services (diff)
downloadsystemd-bb9244781c6fc7608f7cac910269f8987b8adc01.tar.xz
systemd-bb9244781c6fc7608f7cac910269f8987b8adc01.zip
core: don't consider SERVICE_SKIP_CONDITION for abnormal or failure restarts
Fixes: #16115
Diffstat (limited to '')
-rw-r--r--test/units/testsuite-51-repro-1.service9
-rw-r--r--test/units/testsuite-51-repro-2.service9
-rw-r--r--test/units/testsuite-51.service7
-rwxr-xr-xtest/units/testsuite-51.sh12
4 files changed, 37 insertions, 0 deletions
diff --git a/test/units/testsuite-51-repro-1.service b/test/units/testsuite-51-repro-1.service
new file mode 100644
index 0000000000..96ecabe234
--- /dev/null
+++ b/test/units/testsuite-51-repro-1.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Issue 16115 Repro with on-abnormal
+
+[Service]
+Type=simple
+Restart=on-abnormal
+ExecCondition=/bin/false
+ExecStart=sleep 100
+RestartSec=1
diff --git a/test/units/testsuite-51-repro-2.service b/test/units/testsuite-51-repro-2.service
new file mode 100644
index 0000000000..6015ad8080
--- /dev/null
+++ b/test/units/testsuite-51-repro-2.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Issue 16115 Repro with on-failure
+
+[Service]
+Type=simple
+Restart=on-failure
+ExecCondition=/bin/false
+ExecStart=sleep 100
+RestartSec=1
diff --git a/test/units/testsuite-51.service b/test/units/testsuite-51.service
new file mode 100644
index 0000000000..903dc9ab92
--- /dev/null
+++ b/test/units/testsuite-51.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=TEST-51-ISSUE-16115
+
+[Service]
+ExecStartPre=rm -f /failed /testok
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
+Type=oneshot
diff --git a/test/units/testsuite-51.sh b/test/units/testsuite-51.sh
new file mode 100755
index 0000000000..246412a079
--- /dev/null
+++ b/test/units/testsuite-51.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -ex
+set -o pipefail
+
+systemctl start testsuite-51-repro-1
+systemctl start testsuite-51-repro-2
+sleep 5 # wait a bit in case there are restarts so we can count them below
+
+[[ "$(systemctl show testsuite-51-repro-1 -P NRestarts)" == "0" ]]
+[[ "$(systemctl show testsuite-51-repro-2 -P NRestarts)" == "0" ]]
+
+touch /testok