test: move TEST-28-PERCENTJ-WANTEDBY setup to static files

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-12-10 09:32:44 +01:00
parent 468874997a
commit 94370e627f
5 changed files with 27 additions and 35 deletions

View File

@ -15,42 +15,8 @@ test_setup() {
setup_basic_environment
mask_supporting_services
# Set up the services.
cat >$initdir/etc/systemd/system/specifier-j-wants.service << EOF
[Unit]
Description=Wants with percent-j specifier
Wants=specifier-j-depends-%j.service
After=specifier-j-depends-%j.service
[Service]
Type=oneshot
ExecStart=test -f /tmp/test-specifier-j-%j
ExecStart=/bin/sh -c 'echo OK > /testok'
EOF
cat >$initdir/etc/systemd/system/specifier-j-depends-wants.service << EOF
[Unit]
Description=Dependent service for percent-j specifier
[Service]
Type=oneshot
ExecStart=touch /tmp/test-specifier-j-wants
EOF
cat >$initdir/etc/systemd/system/testsuite.service << EOF
[Unit]
Description=Testsuite: Ensure %j Wants directives work
Wants=specifier-j-wants.service
After=specifier-j-wants.service
[Service]
Type=oneshot
ExecStart=/bin/true
EOF
setup_testsuite
)
setup_nspawn_root
}
do_test "$@"
do_test "$@" 28

View File

@ -22,6 +22,8 @@ install_subdir('testsuite-11.units',
install_dir : testdata_dir)
install_subdir('testsuite-16.units',
install_dir : testdata_dir)
install_subdir('testsuite-28.units',
install_dir : testdata_dir)
testsuite08_dir = testdata_dir + '/testsuite-08.units'
install_data('testsuite-08.units/-.mount',

View File

@ -0,0 +1,6 @@
[Unit]
Description=Dependent service for percent-j specifier
[Service]
Type=oneshot
ExecStart=touch /tmp/test-specifier-j-wants

View File

@ -0,0 +1,9 @@
[Unit]
Description=Wants with percent-j specifier
Wants=specifier-j-depends-%j.service
After=specifier-j-depends-%j.service
[Service]
Type=oneshot
ExecStart=test -f /tmp/test-specifier-j-%j
ExecStart=sh -c 'echo OK > /testok'

View File

@ -0,0 +1,9 @@
[Unit]
Description=TEST-28-PERCENTJ-WANTEDBY
# Testsuite: Ensure %j Wants directives work
Wants=specifier-j-wants.service
After=specifier-j-wants.service
[Service]
ExecStart=true
Type=oneshot