Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_nagioscfg.aug
1 (*
2 Module: Test_NagiosCfg
3   Provides unit tests and examples for the <NagiosCfg> lens.
4 *)
5
6 module Test_NagiosCfg =
7     let conf="
8 # LOG FILE
9 log_file=/var/log/nagios3/nagios.log
10
11 # OBJECT CONFIGURATION FILE(S)
12 cfg_file=/etc/nagios3/objects/check_commands.cfg
13 cfg_file=/etc/nagios3/objects/contact_groups.cfg
14 cfg_file=/etc/nagios3/objects/contacts.cfg
15 cfg_file=/etc/nagios3/objects/hostgroups.cfg
16 cfg_file=/etc/nagios3/objects/hosts.cfg
17 cfg_file=/etc/nagios3/objects/services.cfg
18
19 # NAGIOS USER
20 nagios_user=nagios
21
22 # NAGIOS GROUP
23 nagios_group=nagios
24
25 # DATE FORMAT
26 date_format=iso8601
27
28 # ILLEGAL OBJECT NAME CHARS
29 illegal_object_name_chars=`~!$%^&*|'\"<>?,()'=
30
31 # ILLEGAL MACRO OUTPUT CHARS
32 illegal_macro_output_chars=`~$&|'\"<>
33
34 # MISC DIRECTIVES
35 p1_file=/usr/lib/nagios3/p1.pl
36 event_broker_options=-1
37 use_large_installation_tweaks=1
38 broker_module=/usr/lib/nagios3/libNagiosCluster-1.0.so.4.0.0
39 broker_module=/usr/sbin/ndomod.o config_file=/etc/nagios3/ndomod.cfg
40 "
41
42     test NagiosCfg.lns get conf =
43         {}
44         { "#comment"     = "LOG FILE" }
45         { "log_file"    = "/var/log/nagios3/nagios.log" }
46         {}
47         { "#comment"     = "OBJECT CONFIGURATION FILE(S)" }
48         { "cfg_file"    = "/etc/nagios3/objects/check_commands.cfg" }
49         { "cfg_file"    = "/etc/nagios3/objects/contact_groups.cfg" }
50         { "cfg_file"    = "/etc/nagios3/objects/contacts.cfg" }
51         { "cfg_file"    = "/etc/nagios3/objects/hostgroups.cfg" }
52         { "cfg_file"    = "/etc/nagios3/objects/hosts.cfg" }
53         { "cfg_file"    = "/etc/nagios3/objects/services.cfg" }
54         {}
55         { "#comment"     = "NAGIOS USER" }
56         { "nagios_user" = "nagios" }
57         {}
58         { "#comment"     = "NAGIOS GROUP" }
59         { "nagios_group"= "nagios" }
60         {}
61         { "#comment"     = "DATE FORMAT" }
62         { "date_format" = "iso8601" }
63         {}
64         { "#comment"     = "ILLEGAL OBJECT NAME CHARS" }
65         { "illegal_object_name_chars"   = "`~!$%^&*|'\"<>?,()'=" }
66         {}
67         { "#comment"     = "ILLEGAL MACRO OUTPUT CHARS" }
68         { "illegal_macro_output_chars"  = "`~$&|'\"<>" }
69         {}
70         { "#comment"     = "MISC DIRECTIVES" }
71         { "p1_file"     = "/usr/lib/nagios3/p1.pl" }
72         { "event_broker_options"    = "-1" }
73         { "use_large_installation_tweaks"   = "1" }
74         { "broker_module"   = "/usr/lib/nagios3/libNagiosCluster-1.0.so.4.0.0" }
75         { "broker_module"   = "/usr/sbin/ndomod.o"
76            { "config_file" = "/etc/nagios3/ndomod.cfg" } }
77
78
79 (* Spaces are fine in values *)
80 let space_in = "nagios_check_command=/usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3'\n"
81
82 test NagiosCfg.lns get space_in =
83   { "nagios_check_command" = "/usr/lib/nagios/plugins/check_nagios /var/cache/nagios3/status.dat 5 '/usr/sbin/nagios3'" }
84
85 test NagiosCfg.lns get "$USER1$=/usr/local/libexec/nagios\n" =
86   { "$USER1$" = "/usr/local/libexec/nagios" }
87
88 test NagiosCfg.lns get "$USER3$=somepassword\n" =
89   { "$USER3$" = "somepassword" }