test/systemd_unit_create: Wants, Requires, After

Add test values for Wants, Requires, and After.
Adding multiple values to test that arrays work and made sure they're
all different.
The units need to be valid, real unit names otherwise the
'systemd-analyze verify' check will fail.
This commit is contained in:
Achilleas Koutsou 2024-04-16 20:59:17 +02:00 committed by Sanne Raymaekers
parent d40948ce61
commit 86baf802d5

View file

@ -66,7 +66,20 @@ def test_systemd_unit_create(tmp_path, stage_module, unit_type, unit_path, expec
],
"ConditionPathIsDirectory": [
"|!/etc/mydir"
]
],
# need to use real units otherwise the validation will fail
"Wants": [
"basic.target",
"sysinit.target",
],
"Requires": [
"paths.target",
"sockets.target",
],
"After": [
"sysinit.target",
"default.target",
],
},
"Service": {
"Type": "oneshot",
@ -112,6 +125,12 @@ def test_systemd_unit_create(tmp_path, stage_module, unit_type, unit_path, expec
DefaultDependencies=False
ConditionPathExists=|!/etc/myfile
ConditionPathIsDirectory=|!/etc/mydir
Wants=basic.target
Wants=sysinit.target
Requires=paths.target
Requires=sockets.target
After=sysinit.target
After=default.target
[Service]
Type=oneshot