File: systemd-service-test-conf.pl

package info (click to toggle)
libconfig-model-systemd-perl 0.257.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,084 kB
  • sloc: perl: 13,439; makefile: 12
file content (63 lines) | stat: -rw-r--r-- 2,040 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# systemd tests (system files)

use strict;
use warnings;

my $conf_dir = '/etc/systemd/system/';

# list of tests.
my @tests = (
    {
        name => 'sshd-service',
        config_file => $conf_dir.'sshd.service',
        data_from_group => 'systemd',
        setup => {
            'main-sshd' => $conf_dir.'sshd.service.d/override.conf',
            # create symlink from array elements to target file (the last of the array)
            'ssh.service' => [ $conf_dir.'/sshd.service', '/lib/systemd/system/ssh.service' ]
        },
        check => {
            'Service ExecStartPre:0' => { mode => 'layered', value => '/usr/sbin/sshd -t'},
            'Service ExecReload:0' => { mode => 'layered', value => '/usr/sbin/sshd -t'},
            'Service ExecReload:1' => { mode => 'layered', value => '/bin/kill -HUP $MAINPID'},
            'Unit Description' => "OpenBSD Secure Shell server - test override",
        },
        wr_check => {
            'Unit Description' =>  { mode => 'custom', value => "OpenBSD Secure Shell server - test override"},
        }
    },

    {
        name => 'transmission',
        config_file => $conf_dir.'transmission-daemon.service',
        data_from_group => 'systemd',
        setup => {
            'transmission-daemon.service' => '/lib/systemd/system/transmission-daemon.service'
        },
        load => 'Unit After:<you',
        check => {
            'Unit After:0' => { mode => 'user', value => "network.target"},
            'Unit After:1' => "you",
        },
        file_check_sub => sub {
            my $list_ref = shift ;
            push @$list_ref , '/etc/systemd/system/transmission-daemon.service.d/override.conf';
        },
    },

    {
        name => 'condition-list',
        config_file => $conf_dir.'main-test.service',
        data_from_group => 'systemd',
        setup => {
            # Debian  #850228
            'main-test' => $conf_dir.'main-test.service.d/override.conf',
        }
    },

);

return {
    tests => \@tests,
    conf_dir => $conf_dir,
}