diff options
author | Anita Zhang <the.anitazha@gmail.com> | 2020-06-10 10:18:00 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-06-10 17:12:55 +0200 |
commit | bb9244781c6fc7608f7cac910269f8987b8adc01 (patch) | |
tree | 2630b820bf9736e62c07a76cf231b2bd1c828925 /test | |
parent | docs: Change suffix for desktop applications to support non-transient services (diff) | |
download | systemd-bb9244781c6fc7608f7cac910269f8987b8adc01.tar.xz systemd-bb9244781c6fc7608f7cac910269f8987b8adc01.zip |
core: don't consider SERVICE_SKIP_CONDITION for abnormal or failure restarts
Fixes: #16115
Diffstat (limited to '')
l--------- | test/TEST-51-ISSUE-16115/Makefile | 1 | ||||
-rwxr-xr-x | test/TEST-51-ISSUE-16115/test.sh | 6 | ||||
-rw-r--r-- | test/units/testsuite-51-repro-1.service | 9 | ||||
-rw-r--r-- | test/units/testsuite-51-repro-2.service | 9 | ||||
-rw-r--r-- | test/units/testsuite-51.service | 7 | ||||
-rwxr-xr-x | test/units/testsuite-51.sh | 12 |
6 files changed, 44 insertions, 0 deletions
diff --git a/test/TEST-51-ISSUE-16115/Makefile b/test/TEST-51-ISSUE-16115/Makefile new file mode 120000 index 0000000000..e9f93b1104 --- /dev/null +++ b/test/TEST-51-ISSUE-16115/Makefile @@ -0,0 +1 @@ +../TEST-01-BASIC/Makefile
\ No newline at end of file diff --git a/test/TEST-51-ISSUE-16115/test.sh b/test/TEST-51-ISSUE-16115/test.sh new file mode 100755 index 0000000000..eca235c0a6 --- /dev/null +++ b/test/TEST-51-ISSUE-16115/test.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -e +TEST_DESCRIPTION="Test ExecCondition= does not restart on abnormal or failure" +. $TEST_BASE_DIR/test-functions + +do_test "$@" 51 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 |