mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-10 01:17:44 +03:00
test: add tests for "systemctl stop" vs triggering by path unit
This commit is contained in:
parent
2e701a7946
commit
843cb225ad
4
test/testsuite-63.units/test63-issue-24577-dep.service
Normal file
4
test/testsuite-63.units/test63-issue-24577-dep.service
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=bash -c 'sleep infinity'
|
3
test/testsuite-63.units/test63-issue-24577.path
Normal file
3
test/testsuite-63.units/test63-issue-24577.path
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
[Path]
|
||||||
|
PathExists=/tmp/hoge
|
8
test/testsuite-63.units/test63-issue-24577.service
Normal file
8
test/testsuite-63.units/test63-issue-24577.service
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
[Unit]
|
||||||
|
Requires=test63-issue-24577-dep.service
|
||||||
|
After=test63-issue-24577-dep.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=bash -c 'sleep infinity'
|
@ -3,6 +3,9 @@
|
|||||||
set -ex
|
set -ex
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
# shellcheck source=test/units/assert.sh
|
||||||
|
. "$(dirname "$0")"/assert.sh
|
||||||
|
|
||||||
systemctl log-level debug
|
systemctl log-level debug
|
||||||
|
|
||||||
# Test that a path unit continuously triggering a service that fails condition checks eventually fails with
|
# Test that a path unit continuously triggering a service that fails condition checks eventually fails with
|
||||||
@ -41,6 +44,42 @@ systemctl stop test63-glob.path test63-glob.service
|
|||||||
|
|
||||||
test "$(busctl --json=short get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/test63_2dglob_2eservice org.freedesktop.systemd1.Unit ActivationDetails)" = '{"type":"a(ss)","data":[]}'
|
test "$(busctl --json=short get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/test63_2dglob_2eservice org.freedesktop.systemd1.Unit ActivationDetails)" = '{"type":"a(ss)","data":[]}'
|
||||||
|
|
||||||
|
# tests for issue https://github.com/systemd/systemd/issues/24577#issuecomment-1522628906
|
||||||
|
rm -f /tmp/hoge
|
||||||
|
systemctl start test63-issue-24577.path
|
||||||
|
systemctl status -n 0 test63-issue-24577.path
|
||||||
|
systemctl status -n 0 test63-issue-24577.service || :
|
||||||
|
systemctl list-jobs
|
||||||
|
output=$(systemctl list-jobs --no-legend)
|
||||||
|
assert_not_in "test63-issue-24577.service" "$output"
|
||||||
|
assert_not_in "test63-issue-24577-dep.service" "$output"
|
||||||
|
|
||||||
|
touch /tmp/hoge
|
||||||
|
systemctl status -n 0 test63-issue-24577.path
|
||||||
|
systemctl status -n 0 test63-issue-24577.service || :
|
||||||
|
systemctl list-jobs
|
||||||
|
output=$(systemctl list-jobs --no-legend)
|
||||||
|
assert_in "test63-issue-24577.service" "$output"
|
||||||
|
assert_in "test63-issue-24577-dep.service" "$output"
|
||||||
|
|
||||||
|
# even if the service is stopped, it will be soon retriggered.
|
||||||
|
systemctl stop test63-issue-24577.service
|
||||||
|
systemctl status -n 0 test63-issue-24577.path
|
||||||
|
systemctl status -n 0 test63-issue-24577.service || :
|
||||||
|
systemctl list-jobs
|
||||||
|
output=$(systemctl list-jobs --no-legend)
|
||||||
|
assert_in "test63-issue-24577.service" "$output"
|
||||||
|
assert_in "test63-issue-24577-dep.service" "$output"
|
||||||
|
|
||||||
|
rm -f /tmp/hoge
|
||||||
|
systemctl stop test63-issue-24577.service
|
||||||
|
systemctl status -n 0 test63-issue-24577.path
|
||||||
|
systemctl status -n 0 test63-issue-24577.service || :
|
||||||
|
systemctl list-jobs
|
||||||
|
output=$(systemctl list-jobs --no-legend)
|
||||||
|
assert_not_in "test63-issue-24577.service" "$output"
|
||||||
|
assert_in "test63-issue-24577-dep.service" "$output"
|
||||||
|
|
||||||
systemctl log-level info
|
systemctl log-level info
|
||||||
|
|
||||||
echo OK >/testok
|
echo OK >/testok
|
||||||
|
Loading…
Reference in New Issue
Block a user