From 86baf802d5971fe8fa57750ddee7c964776a18b6 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 16 Apr 2024 20:59:17 +0200 Subject: [PATCH] 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. --- stages/test/test_systemd_unit_create.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/stages/test/test_systemd_unit_create.py b/stages/test/test_systemd_unit_create.py index b686261d..1a601444 100644 --- a/stages/test/test_systemd_unit_create.py +++ b/stages/test/test_systemd_unit_create.py @@ -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