1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

test-execute: add test for that DynamicUser= migrate StateDirectory=

Test for 949befd3f0.
This commit is contained in:
Yu Watanabe 2017-12-03 14:27:32 +09:00
parent f0e018e748
commit 028f3a7f9c
4 changed files with 49 additions and 0 deletions

View File

@ -341,6 +341,13 @@ static void test_exec_dynamicuser(Manager *m) {
test(m, "exec-dynamicuser-fixeduser-one-supplementarygroup.service", 0, CLD_EXITED);
test(m, "exec-dynamicuser-supplementarygroups.service", 0, CLD_EXITED);
test(m, "exec-dynamicuser-statedir.service", 0, CLD_EXITED);
test(m, "exec-dynamicuser-statedir-migrate-step1.service", 0, CLD_EXITED);
test(m, "exec-dynamicuser-statedir-migrate-step2.service", 0, CLD_EXITED);
(void) rm_rf("/var/lib/test-dynamicuser-migrate", REMOVE_ROOT|REMOVE_PHYSICAL);
(void) rm_rf("/var/lib/test-dynamicuser-migrate2", REMOVE_ROOT|REMOVE_PHYSICAL);
(void) rm_rf("/var/lib/private/test-dynamicuser-migrate", REMOVE_ROOT|REMOVE_PHYSICAL);
(void) rm_rf("/var/lib/private/test-dynamicuser-migrate2", REMOVE_ROOT|REMOVE_PHYSICAL);
}
static void test_exec_environment(Manager *m) {

View File

@ -56,6 +56,8 @@ test_data_files = '''
test-execute/exec-capabilityboundingset-simple.service
test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service
test-execute/exec-dynamicuser-fixeduser.service
test-execute/exec-dynamicuser-statedir-migrate-step1.service
test-execute/exec-dynamicuser-statedir-migrate-step2.service
test-execute/exec-dynamicuser-statedir.service
test-execute/exec-dynamicuser-supplementarygroups.service
test-execute/exec-environment-empty.service

View File

@ -0,0 +1,16 @@
[Unit]
Description=Test DynamicUser= migrate StateDirectory= (preparation)
[Service]
ExecStart=/bin/sh -c 'test -w /var/lib/test-dynamicuser-migrate'
ExecStart=/bin/sh -c 'test -w /var/lib/test-dynamicuser-migrate2/hoge'
ExecStart=/bin/sh -c 'test ! -L /var/lib/test-dynamicuser-migrate'
ExecStart=/bin/sh -c 'test ! -L /var/lib/test-dynamicuser-migrate2/hoge'
ExecStart=/bin/sh -c 'test -d /var/lib/test-dynamicuser-migrate'
ExecStart=/bin/sh -c 'test -d /var/lib/test-dynamicuser-migrate2/hoge'
ExecStart=/bin/sh -c 'touch /var/lib/test-dynamicuser-migrate/yay'
ExecStart=/bin/sh -c 'touch /var/lib/test-dynamicuser-migrate2/hoge/yayyay'
Type=oneshot
DynamicUser=no
StateDirectory=test-dynamicuser-migrate test-dynamicuser-migrate2/hoge

View File

@ -0,0 +1,24 @@
[Unit]
Description=Test DynamicUser= migrate StateDirectory= (preparation)
[Service]
ExecStart=/bin/sh -c 'test -w /var/lib/test-dynamicuser-migrate'
ExecStart=/bin/sh -c 'test -w /var/lib/test-dynamicuser-migrate2/hoge'
ExecStart=/bin/sh -c 'test -L /var/lib/test-dynamicuser-migrate'
ExecStart=/bin/sh -c 'test -L /var/lib/test-dynamicuser-migrate2/hoge'
ExecStart=/bin/sh -c 'test -d /var/lib/test-dynamicuser-migrate'
ExecStart=/bin/sh -c 'test -d /var/lib/test-dynamicuser-migrate2/hoge'
ExecStart=/bin/sh -c 'test -f /var/lib/test-dynamicuser-migrate/yay'
ExecStart=/bin/sh -c 'test -f /var/lib/test-dynamicuser-migrate2/hoge/yayyay'
ExecStart=/bin/sh -c 'test -d /var/lib/private/test-dynamicuser-migrate'
ExecStart=/bin/sh -c 'test -d /var/lib/private/test-dynamicuser-migrate2/hoge'
ExecStart=/bin/sh -c 'test -f /var/lib/private/test-dynamicuser-migrate/yay'
ExecStart=/bin/sh -c 'test -f /var/lib/private/test-dynamicuser-migrate2/hoge/yayyay'
ExecStart=/bin/sh -c 'touch /var/lib/test-dynamicuser-migrate/yay'
ExecStart=/bin/sh -c 'touch /var/lib/test-dynamicuser-migrate2/hoge/yayyay'
ExecStart=/bin/sh -c 'touch /var/lib/private/test-dynamicuser-migrate/yay'
ExecStart=/bin/sh -c 'touch /var/lib/private/test-dynamicuser-migrate2/hoge/yayyay'
Type=oneshot
DynamicUser=yes
StateDirectory=test-dynamicuser-migrate test-dynamicuser-migrate2/hoge