Debian Codegraph @

tests/test-bdii

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 working_dir=$(mktempscip-shell system . . mktemp. -d)
4
5 cpscip-shell system . . cp. -r ldif provider plugin ${working_dir}
6
7 . /etc/bdii/bdii.confscip-shell source . . `/etc/bdii/bdii.conf`.
8
9 chownscip-shell system . . chown. $BDII_USER:$BDII_USER ${working_dir}
10 chmodscip-shell system . . chmod. +x ${working_dir}/provider/* ${working_dir}/plugin/*
11
12 sedscip-shell system . . sed. "s#/var/lib/bdii/gip#${working_dir}#" /etc/bdii/bdii.confscip-shell filesystem . . `/etc/bdii/bdii.conf`. > ${working_dir}/bdii.conf
13
14 sedscip-shell system . . sed. -i "s#BDII_READ_TIMEOUT=.*#BDII_READ_TIMEOUT=3#" ${working_dir}/bdii.conf
15 sedscip-shell system . . sed. -i "s#BDII_BREATHE_TIME=.*#BDII_BREATHE_TIME=10#" ${working_dir}/bdii.conf
16 sedscip-shell system . . sed. -i "s#BDII_DELETE_DELAY=.*#BDII_DELETE_DELAY=2#" ${working_dir}/bdii.conf
17 sedscip-shell system . . sed. -i "s#ERROR#DEBUG#" ${working_dir}/bdii.conf
18 sedscip-shell system . . sed. -i "s#/var/log/bdii#${working_dir}#" ${working_dir}/bdii.conf
19
20
21 export BDII_CONF=${working_dir}/bdii.conf
22 /etc/init.d/bdiiscip-shell filesystem . . `/etc/init.d/bdii`. restart
23
24
25 command="ldapsearch -LLL -x -h $(hostnamescip-shell system . . hostname. -f) -p 2170 -b o=grid"
26 command_glue2="ldapsearch -LLL -x -h $(hostnamescip-shell system . . hostname. -f) -p 2170 -b o=glue"
27 RETVAL=0
28 echoscip-shell system . . echo. "Waiting 10 seconds for the BDII to start."
29 sleepscip-shell system . . sleep. 10
30
31 echoscip-shell system . . echo. -n "Testing the timeout for hanging providers: "
32 ${command} >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
33 if [scip-shell system . . `[`. $? -eq 32 ]; then
34 echoscip-shell system . . echo. "FAIL"
35 RETVAL=1
36 else
37 echoscip-shell system . . echo. "OK"
38 fi
39
40 echoscip-shell system . . echo. -n "Testing static LDIF file: "
41 filter=GlueServiceUniqueID
42 ${command} ${filter} | grepscip-shell system . . grep. "service_1" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
43 if [scip-shell system . . `[`. $? -gt 0 ]; then
44 echoscip-shell system . . echo. "FAIL"
45 RETVAL=1
46 else
47 echoscip-shell system . . echo. "OK"
48 fi
49
50 echoscip-shell system . . echo. -n "Testing GLUE2 service: "
51 filter=objectClass=GLUE2Service
52 ${command_glue2} ${filter} | grepscip-shell system . . grep. "glue2-service" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
53 if [scip-shell system . . `[`. $? -gt 0 ]; then
54 echoscip-shell system . . echo. "FAIL"
55 RETVAL=1
56 else
57 echoscip-shell system . . echo. "OK"
58 fi
59
60 echoscip-shell system . . echo. -n "Testing GlueTop modification: "
61 filter="objectClass=MDS"
62 ${command} ${filter} | grepscip-shell system . . grep. "nordugrid_1" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
63 if [scip-shell system . . `[`. $? -gt 0 ]; then
64 echoscip-shell system . . echo. "FAIL"
65 RETVAL=1
66 else
67 echoscip-shell system . . echo. "OK"
68 fi
69
70 echoscip-shell system . . echo. -n "Testing provider: "
71 filter="GlueServiceUniqueID=service_2"
72 ${command} ${filter} | grepscip-shell system . . grep. "service_2" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
73 if [scip-shell system . . `[`. $? -gt 0 ]; then
74 echoscip-shell system . . echo. "FAIL"
75 RETVAL=1
76 else
77 echoscip-shell system . . echo. "OK"
78 fi
79
80 echoscip-shell system . . echo. -n "Testing GLUE2 provider: "
81 filter="objectClass=GLUE2Service"
82 ${command_glue2} ${filter} | grepscip-shell system . . grep. "cream-06" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
83 if [scip-shell system . . `[`. $? -gt 0 ]; then
84 echoscip-shell system . . echo. "FAIL"
85 RETVAL=1
86 else
87 echoscip-shell system . . echo. "OK"
88 fi
89
90 echoscip-shell system . . echo. -n "Testing the handling of long DNs: "
91 filter="GlueServiceUniqueID"
92 ${command} ${filter} | grepscip-shell system . . grep. "really_long" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
93 if [scip-shell system . . `[`. $? -gt 0 ]; then
94 echoscip-shell system . . echo. "FAIL"
95 RETVAL=1
96 else
97 echoscip-shell system . . echo. "OK"
98 fi
99
100 echoscip-shell system . . echo. -n "Testing ignoring of junk files: "
101 filter="GlueServiceUniqueID=service_4"
102 ${command} ${filter} | grepscip-shell system . . grep. "service_4" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
103 if [scip-shell system . . `[`. $? -gt 0 ]; then
104 echoscip-shell system . . echo. "OK"
105 else
106 echoscip-shell system . . echo. "FAIL"
107 RETVAL=1
108 fi
109
110 echoscip-shell system . . echo. -n "Testing basic plugin: "
111 filter=GlueServiceStatus=Failed
112 ${command} ${filter} | grepscip-shell system . . grep. "Failed" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
113 if [scip-shell system . . `[`. $? -gt 0 ]; then
114 echoscip-shell system . . echo. "FAIL"
115 RETVAL=1
116 else
117 echoscip-shell system . . echo. "OK"
118 fi
119
120 echoscip-shell system . . echo. -n "Testing plugin mutlivalued delete: "
121 filter=GlueServiceAccessControlBaseRule
122 ${command} ${filter} | grepscip-shell system . . grep. "atlas" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
123 if [scip-shell system . . `[`. $? -gt 0 ]; then
124 echoscip-shell system . . echo. "OK"
125 else
126 echoscip-shell system . . echo. "FAIL"
127 RETVAL=1
128 fi
129
130 echoscip-shell system . . echo. -n "Testing plugin mutlivalued add: "
131 filter=GlueServiceAccessControlBaseRule=cms
132 ${command} ${filter} | grepscip-shell system . . grep. "cms" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
133 if [scip-shell system . . `[`. $? -gt 0 ]; then
134 echoscip-shell system . . echo. "FAIL"
135 RETVAL=1
136 else
137 echoscip-shell system . . echo. "OK"
138 fi
139
140 echoscip-shell system . . echo. -n "Testing plugin modify: "
141 filter=GlueServiceStatusInfo
142 ${command} ${filter} | grepscip-shell system . . grep. "Broken" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
143 if [scip-shell system . . `[`. $? -gt 0 ]; then
144 echoscip-shell system . . echo. "FAIL"
145 RETVAL=1
146 else
147 echoscip-shell system . . echo. "OK"
148 fi
149
150 echoscip-shell system . . echo. -n "Testing two plugins extending the attribute: "
151 filter="GlueServiceUniqueID=service_7"
152 ${command} ${filter} | grepscip-shell system . . grep. "vo_1" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
153 if [scip-shell system . . `[`. $? -gt 0 ]; then
154 echoscip-shell system . . echo. "FAIL"
155 RETVAL=1
156 else
157 echoscip-shell system . . echo. "OK"
158 fi
159
160 rmscip-shell system . . rm. -f ${working_dir}/ldif/service-long-dn.ldif
161 rmscip-shell system . . rm. -f ${working_dir}/ldif/service-unstable.ldif
162 rmscip-shell system . . rm. -f ${working_dir}/ldif/service-spaces-2.ldif
163 sedscip-shell system . . sed. -i "s#Failed#Unknown#" ${working_dir}/plugin/service-status
164 sedscip-shell system . . sed. -i "s#=# = #" ${working_dir}/ldif/service-spaces-1.ldif
165 sedscip-shell system . . sed. -i "s#2011-02-07T10:57:48Z#2011-02-07T10:58:57Z#" ${working_dir}/provider/glue2-provider
166
167 echoscip-shell system . . echo. "Wating for update ..."
168 sleepscip-shell system . . sleep. 14
169
170 echoscip-shell system . . echo. -n "Testing modify on update: "
171 filter=GlueServiceStatus=Unknown
172 ${command} ${filter} | grepscip-shell system . . grep. "Unknown" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
173 if [scip-shell system . . `[`. $? -gt 0 ]; then
174 echoscip-shell system . . echo. "FAIL"
175 RETVAL=1
176 else
177 echoscip-shell system . . echo. "OK"
178 fi
179
180 echoscip-shell system . . echo. -n "Testing modify GLUE2 Service: "
181 filter=objectClass=GLUE2Service
182 ${command_glue2} ${filter} | grepscip-shell system . . grep. "GLUE2_Serivce_OK" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
183 if [scip-shell system . . `[`. $? -gt 0 ]; then
184 echoscip-shell system . . echo. "FAIL"
185 RETVAL=1
186 else
187 echoscip-shell system . . echo. "OK"
188 fi
189
190 echoscip-shell system . . echo. -n "Testing GLUE2 provider updated: "
191 filter="objectClass=GLUE2Service"
192 ${command_glue2} ${filter} | grepscip-shell system . . grep. "2011-02-07T10:58:57Z" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
193 if [scip-shell system . . `[`. $? -gt 0 ]; then
194 echoscip-shell system . . echo. "FAIL"
195 RETVAL=1
196 else
197 echoscip-shell system . . echo. "OK"
198 fi
199
200 echoscip-shell system . . echo. -n "Testing delayed delete: "
201 filter=GlueServiceUniqueID
202 ${command} ${filter} | grepscip-shell system . . grep. "_long_" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
203 if [scip-shell system . . `[`. $? -gt 0 ]; then
204 echoscip-shell system . . echo. "FAIL"
205 RETVAL=1
206 else
207 echoscip-shell system . . echo. "OK"
208 fi
209
210 echoscip-shell system . . echo. -n "Testing ignoring spaces in dn: "
211 filter=GlueServiceUniqueID
212 ${command} ${filter} | grepscip-shell system . . grep. "service_5" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
213 if [scip-shell system . . `[`. $? -gt 0 ]; then
214 echoscip-shell system . . echo. "FAIL"
215 RETVAL=1
216 else
217 echoscip-shell system . . echo. "OK"
218 fi
219
220 echoscip-shell system . . echo. -n "Testing dn special character '\': "
221 filter=GlueServiceUniqueID
222 ${command} ${filter} | grepscip-shell system . . grep. "slash" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
223 if [scip-shell system . . `[`. $? -gt 0 ]; then
224 echoscip-shell system . . echo. "FAIL"
225 RETVAL=1
226 else
227 echoscip-shell system . . echo. "OK"
228 fi
229
230 echoscip-shell system . . echo. -n "Testing dn special character ',': "
231 filter=GlueServiceUniqueID
232 ${command} ${filter} | grepscip-shell system . . grep. "comma" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
233 if [scip-shell system . . `[`. $? -gt 0 ]; then
234 echoscip-shell system . . echo. "FAIL"
235 RETVAL=1
236 else
237 echoscip-shell system . . echo. "OK"
238 fi
239
240 echoscip-shell system . . echo. -n "Testing dn special character '=': "
241 filter=GlueServiceUniqueID
242 ${command} ${filter} | grepscip-shell system . . grep. "equal" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
243 if [scip-shell system . . `[`. $? -gt 0 ]; then
244 echoscip-shell system . . echo. "FAIL"
245 RETVAL=1
246 else
247 echoscip-shell system . . echo. "OK"
248 fi
249
250 echoscip-shell system . . echo. -n "Testing dn special character '+': "
251 filter=GlueServiceUniqueID
252 ${command} ${filter} | grepscip-shell system . . grep. "plus" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
253 if [scip-shell system . . `[`. $? -gt 0 ]; then
254 echoscip-shell system . . echo. "FAIL"
255 RETVAL=1
256 else
257 echoscip-shell system . . echo. "OK"
258 fi
259
260 echoscip-shell system . . echo. -n "Testing dn special character '\"': "
261 filter=GlueServiceUniqueID
262 ${command} ${filter} | grepscip-shell system . . grep. "quote" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
263 if [scip-shell system . . `[`. $? -gt 0 ]; then
264 echoscip-shell system . . echo. "FAIL"
265 RETVAL=1
266 else
267 echoscip-shell system . . echo. "OK"
268 fi
269
270 echoscip-shell system . . echo. -n "Testing dn special character ';': "
271 filter=GlueServiceUniqueID
272 ${command} ${filter} | grepscip-shell system . . grep. "semi" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
273 if [scip-shell system . . `[`. $? -gt 0 ]; then
274 echoscip-shell system . . echo. "FAIL"
275 RETVAL=1
276 else
277 echoscip-shell system . . echo. "OK"
278 fi
279
280 echoscip-shell system . . echo. -n "Testing dn special character '<': "
281 filter=GlueServiceUniqueID
282 ${command} ${filter} | grepscip-shell system . . grep. "less" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
283 if [scip-shell system . . `[`. $? -gt 0 ]; then
284 echoscip-shell system . . echo. "FAIL"
285 RETVAL=1
286 else
287 echoscip-shell system . . echo. "OK"
288 fi
289
290 echoscip-shell system . . echo. -n "Testing dn special character '>': "
291 filter=GlueServiceUniqueID
292 ${command} ${filter} | grepscip-shell system . . grep. "greater" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
293 if [scip-shell system . . `[`. $? -gt 0 ]; then
294 echoscip-shell system . . echo. "FAIL"
295 RETVAL=1
296 else
297 echoscip-shell system . . echo. "OK"
298 fi
299
300 cpscip-shell system . . cp. ldif/service-unstable.ldif -f ${working_dir}/ldif/
301 echoscip-shell system . . echo. "Wating for update ..."
302 sleepscip-shell system . . sleep. 13
303
304 echoscip-shell system . . echo. -n "Testing deleting obsolete entry: "
305 filter=GlueServiceUniqueID
306 ${command} ${filter} | grepscip-shell system . . grep. "_long_" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
307 if [scip-shell system . . `[`. ! $? -gt 0 ]; then
308 echoscip-shell system . . echo. "FAIL"
309 RETVAL=1
310 else
311 echoscip-shell system . . echo. "OK"
312 fi
313
314 echoscip-shell system . . echo. -n "Testing delete with space in uniqueID: "
315 filter=GlueServiceUniqueID
316 ${command} ${filter} | grepscip-shell system . . grep. "service 6" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
317 if [scip-shell system . . `[`. ! $? -gt 0 ]; then
318 echoscip-shell system . . echo. "FAIL"
319 RETVAL=1
320 else
321 echoscip-shell system . . echo. "OK"
322 fi
323
324 echoscip-shell system . . echo. -n "Testing unstable service is not deleted: "
325 filter=GlueServiceUniqueID
326 ${command} ${filter} | grepscip-shell system . . grep. "service_7" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
327 if [scip-shell system . . `[`. $? -gt 0 ]; then
328 echoscip-shell system . . echo. "FAIL"
329 RETVAL=1
330 else
331 echoscip-shell system . . echo. "OK"
332 fi
333
334 rmscip-shell system . . rm. -f ${working_dir}/ldif/service-unstable.ldif
335 echoscip-shell system . . echo. "Wating for update ..."
336 sleepscip-shell system . . sleep. 13
337
338 echoscip-shell system . . echo. -n "Testing unstable service is not deleted: "
339 filter=GlueServiceUniqueID
340 ${command} ${filter} | grepscip-shell system . . grep. "service_7" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
341 if [scip-shell system . . `[`. $? -gt 0 ]; then
342 echoscip-shell system . . echo. "FAIL"
343 RETVAL=1
344 else
345 echoscip-shell system . . echo. "OK"
346 fi
347
348 echoscip-shell system . . echo. "Wating for update ..."
349 sleepscip-shell system . . sleep. 13
350
351 echoscip-shell system . . echo. -n "Testing unstable service is deleted: "
352 filter=GlueServiceUniqueID
353 ${command} ${filter} | grepscip-shell system . . grep. "service_7" >/dev/nullscip-shell filesystem . . `/dev/null`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.
354 if [scip-shell system . . `[`. ! $? -gt 0 ]; then
355 echoscip-shell system . . echo. "FAIL"
356 RETVAL=1
357 else
358 echoscip-shell system . . echo. "OK"
359 fi
360
361 /etc/init.d/bdiiscip-shell filesystem . . `/etc/init.d/bdii`. stop
362 mvscip-shell system . . mv. ${working_dir}/bdii-update.log /tmpscip-shell filesystem . . `/tmp`.
363 rmscip-shell system . . rm. -rf ${working_dir}
364
365 if [scip-shell system . . `[`. ${RETVAL} -eq 1 ]; then
366 echoscip-shell system . . echo. "Test Failed"
367 exit 1
368 else
369 echoscip-shell system . . echo. "Test Passed"
370 exit 0
371 fi