File: layer-test-conf.pl

package info (click to toggle)
libconfig-model-perl 2.155-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,172 kB
  • sloc: perl: 15,117; makefile: 19
file content (51 lines) | stat: -rw-r--r-- 1,378 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
use Config::Model::BackendMgr;
# test loading layered config à la ssh_config
use strict;
use warnings;

my $home_for_test = '/home/joe' ;
Config::Model::BackendMgr::_set_test_home($home_for_test) ;

 my @config_classes = ({
    name    => "LayeredClass",
    element => [
      [qw/set_in_etc set_by_user set_in_both/] , {
            'value_type' => 'uniline',
            'type' => 'leaf',
      },
      'a_checklist' =>  {
        #'default_list' => [ qw/b c/ ],
        'type' => 'check_list',
        'choice' => [ 'a' .. 'g' ]
      },
    ],
    'rw_config' => {
        'backend' => 'perl_file',
        'config_dir' => '~/foo',
        'file' => 'config.pl',
        'default_layer' => { 
            'config_dir' => '/etc',
            'file' => 'foo-config.pl'
        }
    }
});

my @tests = ({
    name => 'mini',
    check => [
        set_in_etc => {qw/mode layered value /, 'system value'},
        set_in_both => {qw/mode layered value /, 'system value2'},
        set_in_both => {qw/mode user value /, 'user value2'},
        set_by_user => 'user value',
        a_checklist => {qw/mode layered value /,'c,e'},
        a_checklist => 'f,g',
        a_checklist => {qw/mode user value /,   'c,f,g'},
    ]
});

return {
    model_to_test => "LayeredClass",
    config_classes => \@config_classes,
    home_for_test => $home_for_test,
    tests => \@tests
};