diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-09-28 23:41:06 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-10-02 17:41:44 +0200 |
commit | 8adb3d63e6b0f51d1d43467e794ef4fb45203f57 (patch) | |
tree | ee6a2473085b0abf75dc97cb2f78c91169cd82e1 /test | |
parent | e53c42ca0a0568579c50b2377b52777ce67a311f (diff) | |
download | systemd-8adb3d63e6b0f51d1d43467e794ef4fb45203f57.tar.gz systemd-8adb3d63e6b0f51d1d43467e794ef4fb45203f57.tar.bz2 systemd-8adb3d63e6b0f51d1d43467e794ef4fb45203f57.zip |
test: add test for DynamicUser= + StateDirectory=
Also, tests for DynamicUser= should really run for system mode, as we
allocate from a system resource.
(This also increases the test timeout to 2min. If one of our tests
really hangs then waiting for 2min longer doesn't hurt either. The old
2s is really short, given that we run in potentially slow VM
environments for this test. This becomes noticable when the slow "find"
command this adds is triggered)
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 1 | ||||
-rw-r--r-- | test/test-execute/exec-dynamicuser-state-dir.service | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build index 9fdcd2d8d2..991d3fcc92 100644 --- a/test/meson.build +++ b/test/meson.build @@ -64,6 +64,7 @@ test_data_files = ''' test-execute/exec-dynamicuser-fixeduser.service test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service test-execute/exec-dynamicuser-supplementarygroups.service + test-execute/exec-dynamicuser-state-dir.service test-execute/exec-ignoresigpipe-no.service test-execute/exec-ignoresigpipe-yes.service test-execute/exec-personality-x86-64.service diff --git a/test/test-execute/exec-dynamicuser-state-dir.service b/test/test-execute/exec-dynamicuser-state-dir.service new file mode 100644 index 0000000000..7e2d88450b --- /dev/null +++ b/test/test-execute/exec-dynamicuser-state-dir.service @@ -0,0 +1,19 @@ +[Unit] +Description=Test DynamicUser= with StateDirectory= + +[Service] +ExecStart=/usr/bin/test -w /var/lib/waldo +ExecStart=/usr/bin/test -w /var/lib/quux/pief +ExecStart=/bin/touch /var/lib/waldo/yay +ExecStart=/bin/touch /var/lib/quux/pief/yayyay +ExecStart=/usr/bin/test -f /var/lib/waldo/yay +ExecStart=/usr/bin/test -f /var/lib/quux/pief/yayyay +ExecStart=/usr/bin/test -f /var/lib/private/waldo/yay +ExecStart=/usr/bin/test -f /var/lib/private/quux/pief/yayyay + +# Make sure that /var/lib/private/waldo is really the only writable directory besides the obvious candidates +ExecStart=/bin/sh -x -c 'test $$(find / -type d -writable 2> /dev/null | egrep -v -e \'^(/var/tmp$$|/tmp$$|/proc/|/dev/mqueue$$|/dev/shm$$)\' | sort -u | tr -d '\\\\n') = /var/lib/private/quux/pief/var/lib/private/waldo' + +Type=oneshot +DynamicUser=yes +StateDirectory=waldo quux/pief |