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 64 65 66 67
|
use strict;
use warnings;
# test inifile backend with multiple ini files
# create minimal model to test ini file backend.
# this class is used by MultiMiniIni class below
my @config_classes = ({
name => 'MultiIniTest::Class',
element => [
int_with_max => {qw/type leaf value_type integer max 10/},
],
rw_config => {
backend => 'IniFile',
config_dir => '/etc/',
file => '&index.conf',
auto_create => 1,
},
});
push @config_classes, {
name => 'MultiMiniIni',
element => [
service => {
type => 'hash',
index_type => 'string',
# require to trigger load of bar.conf
default_keys => 'bar',
cargo => {
type => 'node',
config_class_name => 'MultiIniTest::Class'
}
},
],
rw_config => {
backend => 'perl',
config_dir => '/etc/',
file => 'service.pl',
auto_create => 1,
},
};
# the test suite
my @tests = (
{
name => 'max-overflow',
load_check => 'no',
# work only with Config::Model > 2.094 because of an obscure
# initialisation bug occuring while loading a bad value in
# a sub-node (thanks systemd)
load => 'service:bar int_with_max=9',
file_check_sub => sub {
my $list_ref = shift ;
# file added because of default bar key
push @$list_ref, "/etc/service.pl" ;
},
},
);
return {
# specify the name of the class to test
model_to_test => "MultiMiniIni",
config_classes => \@config_classes,
tests => \@tests
};
|