1(*
2Module: Test_Up2date
3  Provides unit tests and examples for the <Up2date> lens.
4*)
5
6module Test_Up2date =
7
8(* Variable: empty *)
9let empty = "keyword=
10"
11test Up2date.lns get empty =
12  { "1" = "keyword" }
13
14(* Variable: list_empty *)
15let list_empty = "keyword=;
16"
17test Up2date.lns get list_empty =
18  { "1" = "keyword"
19    { "values" } }
20
21(* Variable: list_one *)
22let list_one = "keyword=foo;
23"
24test Up2date.lns get list_one =
25  { "1" = "keyword"
26    { "values"
27      { "1" = "foo" } } }
28
29(* Variable: list_two
30   Probably not useful, up2date throws "bar" away *)
31let list_two = "keyword=foo;bar
32"
33test Up2date.lns get list_two =
34  { "1" = "keyword"
35    { "values"
36      { "1" = "foo" }
37      { "2" = "bar" } } }
38
39(* Variable: list_two_trailing *)
40let list_two_trailing = "keyword=foo;bar;
41"
42test Up2date.lns get list_two_trailing =
43  { "1" = "keyword"
44    { "values"
45      { "1" = "foo" }
46      { "2" = "bar" } } }
47
48(* Variable: conf *)
49let conf = "# Red Hat Update Agent config file.
50# Format: 1.0
51
52debug[comment]=Whether or not debugging is enabled
53debug=0
54
55systemIdPath[comment]=Location of system id
56systemIdPath=/etc/sysconfig/rhn/systemid
57
58serverURL[comment]=Remote server URL (use FQDN)
59#serverURL=https://xmlrpc.rhn.redhat.com/XMLRPC
60serverURL=https://enter.your.server.url.here/XMLRPC
61
62hostedWhitelist[comment]=RHN Hosted URL's
63hostedWhitelist=
64
65enableProxy[comment]=Use a HTTP Proxy
66enableProxy=0
67
68versionOverride[comment]=Override the automatically determined system version
69versionOverride=
70
71httpProxy[comment]=HTTP proxy in host:port format, e.g. squid.redhat.com:3128
72httpProxy=
73
74noReboot[comment]=Disable the reboot actions
75noReboot=0
76
77networkRetries[comment]=Number of attempts to make at network connections before giving up
78networkRetries=1
79
80disallowConfChanges[comment]=Config options that can not be overwritten by a config update action
81disallowConfChanges=noReboot;sslCACert;useNoSSLForPackages;noSSLServerURL;serverURL;disallowConfChanges;
82
83sslCACert[comment]=The CA cert used to verify the ssl server
84sslCACert=/usr/share/rhn/RHNS-CA-CERT
85
86# Akamai does not support http protocol, therefore setting this option as side effect disable \"Location aware\" function
87useNoSSLForPackages[comment]=Use the noSSLServerURL for package, package list, and header fetching (disable Akamai)
88useNoSSLForPackages=0
89
90retrieveOnly[comment]=Retrieve packages only
91retrieveOnly=0
92
93skipNetwork[comment]=Skips network information in hardware profile sync during registration.
94skipNetwork=0
95
96tmpDir[comment]=Use this Directory to place the temporary transport files
97tmpDir=/tmp
98
99writeChangesToLog[comment]=Log to /var/log/up2date which packages has been added and removed
100writeChangesToLog=0
101
102stagingContent[comment]=Retrieve content of future actions in advance
103stagingContent=1
104
105stagingContentWindow[comment]=How much forward we should look for future actions. In hours.
106stagingContentWindow=24
107"
108
109(* Test: Up2date.lns *)
110test Up2date.lns get conf =
111  { "#comment" = "Red Hat Update Agent config file." }
112  { "#comment" = "Format: 1.0" }
113  {  }
114  { "1" = "debug[comment]"
115    { "value" = "Whether or not debugging is enabled" } }
116  { "2" = "debug"
117    { "value" = "0" } }
118  {  }
119  { "3" = "systemIdPath[comment]"
120    { "value" = "Location of system id" } }
121  { "4" = "systemIdPath"
122    { "value" = "/etc/sysconfig/rhn/systemid" } }
123  {  }
124  { "5" = "serverURL[comment]"
125    { "value" = "Remote server URL (use FQDN)" } }
126  { "#comment" = "serverURL=https://xmlrpc.rhn.redhat.com/XMLRPC" }
127  { "6" = "serverURL"
128    { "value" = "https://enter.your.server.url.here/XMLRPC" } }
129  {  }
130  { "7" = "hostedWhitelist[comment]"
131    { "value" = "RHN Hosted URL's" } }
132  { "8" = "hostedWhitelist" }
133  {  }
134  { "9" = "enableProxy[comment]"
135    { "value" = "Use a HTTP Proxy" } }
136  { "10" = "enableProxy"
137    { "value" = "0" } }
138  {  }
139  { "11" = "versionOverride[comment]"
140    { "value" = "Override the automatically determined system version" } }
141  { "12" = "versionOverride" }
142  {  }
143  { "13" = "httpProxy[comment]"
144    { "value" = "HTTP proxy in host:port format, e.g. squid.redhat.com:3128" } }
145  { "14" = "httpProxy" }
146  {  }
147  { "15" = "noReboot[comment]"
148    { "value" = "Disable the reboot actions" } }
149  { "16" = "noReboot"
150    { "value" = "0" } }
151  {  }
152  { "17" = "networkRetries[comment]"
153    { "value" = "Number of attempts to make at network connections before giving up" } }
154  { "18" = "networkRetries"
155    { "value" = "1" } }
156  {  }
157  { "19" = "disallowConfChanges[comment]"
158    { "value" = "Config options that can not be overwritten by a config update action" } }
159  { "20" = "disallowConfChanges"
160    { "values"
161      { "1" = "noReboot" }
162      { "2" = "sslCACert" }
163      { "3" = "useNoSSLForPackages" }
164      { "4" = "noSSLServerURL" }
165      { "5" = "serverURL" }
166      { "6" = "disallowConfChanges" } } }
167  {  }
168  { "21" = "sslCACert[comment]"
169    { "value" = "The CA cert used to verify the ssl server" } }
170  { "22" = "sslCACert"
171    { "value" = "/usr/share/rhn/RHNS-CA-CERT" } }
172  {  }
173  { "#comment" = "Akamai does not support http protocol, therefore setting this option as side effect disable \"Location aware\" function" }
174  { "23" = "useNoSSLForPackages[comment]"
175    { "value" = "Use the noSSLServerURL for package, package list, and header fetching (disable Akamai)" } }
176  { "24" = "useNoSSLForPackages"
177    { "value" = "0" } }
178  {  }
179  { "25" = "retrieveOnly[comment]"
180    { "value" = "Retrieve packages only" } }
181  { "26" = "retrieveOnly"
182    { "value" = "0" } }
183  {  }
184  { "27" = "skipNetwork[comment]"
185    { "value" = "Skips network information in hardware profile sync during registration." } }
186  { "28" = "skipNetwork"
187    { "value" = "0" } }
188  {  }
189  { "29" = "tmpDir[comment]"
190    { "value" = "Use this Directory to place the temporary transport files" } }
191  { "30" = "tmpDir"
192    { "value" = "/tmp" } }
193  {  }
194  { "31" = "writeChangesToLog[comment]"
195    { "value" = "Log to /var/log/up2date which packages has been added and removed" } }
196  { "32" = "writeChangesToLog"
197    { "value" = "0" } }
198  {  }
199  { "33" = "stagingContent[comment]"
200    { "value" = "Retrieve content of future actions in advance" } }
201  { "34" = "stagingContent"
202    { "value" = "1" } }
203  {  }
204  { "35" = "stagingContentWindow[comment]"
205    { "value" = "How much forward we should look for future actions. In hours." } }
206  { "36" = "stagingContentWindow"
207    { "value" = "24" } }
208
209
210