]> git.sur5r.net Git - openldap/blob - tests/scripts/test050-syncrepl-multimaster
ITS#5086
[openldap] / tests / scripts / test050-syncrepl-multimaster
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2007 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
11 ##
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
15
16 echo "running defines.sh"
17 . $SRCDIR/scripts/defines.sh
18
19 if test $SYNCPROV = syncprovno; then 
20         echo "Syncrepl provider overlay not available, test skipped"
21         exit 0
22 fi 
23
24 PRODIR=$TESTDIR/pro
25 CONDIR=$TESTDIR/con
26 CONDIR2=$TESTDIR/con2
27 DBPRO=$PRODIR/db
28 DBCON=$CONDIR/db
29 DBCON2=$CONDIR2/db
30 CFPRO=$PRODIR/slapd.d
31 CFCON=$CONDIR/slapd.d
32 CFCON2=$CONDIR2/slapd.d
33
34 mkdir -p $TESTDIR $PRODIR $CONDIR $CONDIR2 $DBPRO $DBCON $DBCON2 $CFPRO $CFCON $CFCON2
35
36 $SLAPPASSWD -g -n >$CONFIGPWF
37
38 #
39 # Test replication of dynamic config:
40 # - start producer
41 # - start consumer
42 # - start consumer2
43 # - configure over ldap
44 # - populate over ldap
45 # - configure syncrepl over ldap
46 # - retrieve database over ldap and compare against expected results
47 #
48
49 echo "Initializing server configurations..."
50 $SLAPADD -F $CFCON2 -n 0 <<EOF
51 dn: cn=config
52 objectClass: olcGlobal
53 cn: config
54 olcServerID: 3
55
56 dn: olcDatabase={0}config,cn=config
57 objectClass: olcDatabaseConfig
58 olcDatabase: {0}config
59 olcRootPW:< file://$CONFIGPWF
60 EOF
61
62 $SLAPADD -F $CFCON -n 0 <<EOF
63 dn: cn=config
64 objectClass: olcGlobal
65 cn: config
66 olcServerID: 2
67
68 dn: olcDatabase={0}config,cn=config
69 objectClass: olcDatabaseConfig
70 olcDatabase: {0}config
71 olcRootPW:< file://$CONFIGPWF
72 EOF
73
74 $SLAPADD -F $CFPRO -n 0 <<EOF
75 dn: cn=config
76 objectClass: olcGlobal
77 cn: config
78 olcServerID: 1
79
80 dn: olcDatabase={0}config,cn=config
81 objectClass: olcDatabaseConfig
82 olcDatabase: {0}config
83 olcRootPW:< file://$CONFIGPWF
84 EOF
85
86 echo "Starting producer slapd on TCP/IP port $PORT1..."
87 cd $PRODIR
88 $SLAPD -F slapd.d -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
89 PID=$!
90 if test $WAIT != 0 ; then
91     echo PID $PID
92     read foo
93 fi
94 KILLPIDS="$PID"
95 cd $TESTWD
96
97 sleep 1
98
99 echo "Using ldapsearch to check that producer slapd is running..."
100 for i in 0 1 2 3 4 5; do
101         $LDAPSEARCH -s base -b "" -H $URI1 \
102                 'objectclass=*' > /dev/null 2>&1
103         RC=$?
104         if test $RC = 0 ; then
105                 break
106         fi
107         echo "Waiting 5 seconds for slapd to start..."
108         sleep 5
109 done
110
111 if test $RC != 0 ; then
112         echo "ldapsearch failed ($RC)!"
113         test $KILLSERVERS != no && kill -HUP $KILLPIDS
114         exit $RC
115 fi
116
117 echo "Inserting syncprov overlay on producer..."
118 if [ "$SYNCPROV" = syncprovmod ]; then
119         $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
120 dn: cn=module,cn=config
121 objectClass: olcModuleList
122 cn: module
123 olcModulePath: ../../../servers/slapd/overlays
124 olcModuleLoad: syncprov.la
125 EOF
126         RC=$?
127         if test $RC != 0 ; then
128                 echo "ldapadd failed for moduleLoad ($RC)!"
129                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
130                 exit $RC
131         fi
132 fi
133 #
134 # Note that we configure a timeout here; it's possible for both
135 # servers to attempt to bind to each other while a modify to
136 # cn=config is in progress. When the modify pauses the thread pool
137 # neither server will progress. The timeout will drop the syncrepl
138 # attempt and allow the modifies to complete.
139 #
140 read CONFIGPW < $CONFIGPWF
141 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
142 dn: cn=config
143 changetype: modify
144 replace: olcServerID
145 olcServerID: 1 $URI1
146 olcServerID: 2 $URI2
147 olcServerID: 3 $URI3
148
149 dn: olcOverlay=syncprov,olcDatabase={0}config,cn=config
150 changetype: add
151 objectClass: olcOverlayConfig
152 objectClass: olcSyncProvConfig
153 olcOverlay: syncprov
154
155 dn: olcDatabase={0}config,cn=config
156 changetype: modify
157 add: olcSyncRepl
158 olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
159   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
160   retry="5 5 300 5" timeout=1
161 olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
162   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
163   retry="5 5 300 5" timeout=1
164 olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
165   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
166   retry="5 5 300 5" timeout=1
167 -
168 add: olcMirrorMode
169 olcMirrorMode: TRUE
170 EOF
171 RC=$?
172 if test $RC != 0 ; then
173         echo "ldapmodify failed for syncrepl config ($RC)!"
174         test $KILLSERVERS != no && kill -HUP $KILLPIDS
175         exit $RC
176 fi
177
178 echo "Starting consumer slapd on TCP/IP port $PORT2..."
179 cd $CONDIR
180 $SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
181 SLAVEPID=$!
182 if test $WAIT != 0 ; then
183     echo SLAVEPID $SLAVEPID
184     read foo
185 fi
186 KILLPIDS="$KILLPIDS $SLAVEPID"
187 cd $TESTWD
188
189 sleep 1
190
191 echo "Using ldapsearch to check that consumer slapd is running..."
192 for i in 0 1 2 3 4 5; do
193         $LDAPSEARCH -s base -b "" -H $URI2 \
194                 'objectclass=*' > /dev/null 2>&1
195         RC=$?
196         if test $RC = 0 ; then
197                 break
198         fi
199         echo "Waiting 5 seconds for slapd to start..."
200         sleep 5
201 done
202
203 if test $RC != 0 ; then
204         echo "ldapsearch failed ($RC)!"
205         test $KILLSERVERS != no && kill -HUP $KILLPIDS
206         exit $RC
207 fi
208
209 echo "Configuring syncrepl on consumer..."
210 $LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
211 dn: olcDatabase={0}config,cn=config
212 changetype: modify
213 add: olcSyncRepl
214 olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
215   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
216   retry="5 5 300 5" timeout=1
217 olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
218   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
219   retry="5 5 300 5" timeout=1
220 olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
221   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
222   retry="5 5 300 5" timeout=1
223 -
224 add: olcMirrorMode
225 olcMirrorMode: TRUE
226 EOF
227
228 echo "Starting consumer2 slapd on TCP/IP port $PORT3..."
229 cd $CONDIR2
230 $SLAPD -F ./slapd.d -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
231 SLAVE2PID=$!
232 if test $WAIT != 0 ; then
233     echo SLAVE2PID $SLAVE2PID
234     read foo
235 fi
236 KILLPIDS="$KILLPIDS $SLAVE2PID"
237 cd $TESTWD
238
239 sleep 1
240
241 echo "Using ldapsearch to check that consumer2 slapd is running..."
242 for i in 0 1 2 3 4 5; do
243         $LDAPSEARCH -s base -b "" -H $URI3 \
244                 'objectclass=*' > /dev/null 2>&1
245         RC=$?
246         if test $RC = 0 ; then
247                 break
248         fi
249         echo "Waiting 5 seconds for slapd to start..."
250         sleep 5
251 done
252
253 if test $RC != 0 ; then
254         echo "ldapsearch failed ($RC)!"
255         test $KILLSERVERS != no && kill -HUP $KILLPIDS
256         exit $RC
257 fi
258
259 echo "Configuring syncrepl on consumer2..."
260 $LDAPMODIFY -D cn=config -H $URI3 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
261 dn: olcDatabase={0}config,cn=config
262 changetype: modify
263 add: olcSyncRepl
264 olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
265   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
266   retry="5 5 300 5" timeout=1
267 olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
268   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
269   retry="5 5 300 5" timeout=1
270 olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
271   credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
272   retry="5 5 300 5" timeout=1
273 -
274 add: olcMirrorMode
275 olcMirrorMode: TRUE
276 EOF
277
278 echo "Adding schema and databases on producer..."
279 $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
280 include: file://$ABS_SCHEMADIR/core.ldif
281
282 include: file://$ABS_SCHEMADIR/cosine.ldif
283
284 include: file://$ABS_SCHEMADIR/inetorgperson.ldif
285
286 include: file://$ABS_SCHEMADIR/openldap.ldif
287
288 include: file://$ABS_SCHEMADIR/nis.ldif
289 EOF
290 RC=$?
291 if test $RC != 0 ; then
292         echo "ldapadd failed for schema config ($RC)!"
293         test $KILLSERVERS != no && kill -HUP $KILLPIDS
294         exit $RC
295 fi
296
297 if [ "$BACKENDTYPE" = mod ]; then
298         $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
299 dn: cn=module,cn=config
300 objectClass: olcModuleList
301 cn: module
302 olcModulePath: ../../../servers/slapd/back-$BACKEND
303 olcModuleLoad: back_$BACKEND.la
304 EOF
305         RC=$?
306         if test $RC != 0 ; then
307                 echo "ldapadd failed for backend config ($RC)!"
308                 test $KILLSERVERS != no && kill -HUP $KILLPIDS
309                 exit $RC
310         fi
311 fi
312
313 $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
314 dn: olcDatabase={1}$BACKEND,cn=config
315 objectClass: olcDatabaseConfig
316 objectClass: olc${BACKEND}Config
317 olcDatabase: {1}$BACKEND
318 olcSuffix: $BASEDN
319 olcDbDirectory: ./db
320 olcRootDN: $MANAGERDN
321 olcRootPW: $PASSWD
322 olcSyncRepl: rid=004 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
323   credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
324   interval=00:00:00:10 retry="5 5 300 5" timeout=1
325 olcSyncRepl: rid=005 provider=$URI2 binddn="$MANAGERDN" bindmethod=simple
326   credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
327   interval=00:00:00:10 retry="5 5 300 5" timeout=1
328 olcSyncRepl: rid=006 provider=$URI3 binddn="$MANAGERDN" bindmethod=simple
329   credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
330   interval=00:00:00:10 retry="5 5 300 5" timeout=1
331 olcMirrorMode: TRUE
332
333 dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
334 changetype: add
335 objectClass: olcOverlayConfig
336 objectClass: olcSyncProvConfig
337 olcOverlay: syncprov
338 EOF
339 RC=$?
340 if test $RC != 0 ; then
341         echo "ldapadd failed for database config ($RC)!"
342         test $KILLSERVERS != no && kill -HUP $KILLPIDS
343         exit $RC
344 fi
345
346 echo "Using ldapadd to populate producer..."
347 $LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \
348         >> $TESTOUT 2>&1
349 RC=$?
350 if test $RC != 0 ; then
351         echo "ldapadd failed for database config ($RC)!"
352         test $KILLSERVERS != no && kill -HUP $KILLPIDS
353         exit $RC
354 fi
355
356 SLEEP=20
357 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
358 sleep $SLEEP
359
360 echo "Using ldapsearch to check that syncrepl received database changes..."
361 RC=32
362 for i in 0 1 2 3 4 5; do
363         RESULT=`$LDAPSEARCH -H $URI2 \
364                 -s base -b "cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com" \
365                 '(objectClass=*)' 2>&1 | awk '/^dn:/ {print "OK"}'`
366         if test "x$RESULT" = "xOK" ; then
367                 RC=0
368                 break
369         fi
370         echo "Waiting 5 seconds for syncrepl to receive changes..."
371         sleep 5
372 done
373
374 if test $RC != 0 ; then
375         echo "ldapsearch failed ($RC)!"
376         test $KILLSERVERS != no && kill -HUP $KILLPIDS
377         exit $RC
378 fi
379
380 echo "Using ldapsearch to check that syncrepl received database changes on consumer2..."
381 RC=32
382 for i in 0 1 2 3 4 5; do
383         RESULT=`$LDAPSEARCH -H $URI3 \
384                 -s base -b "cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com" \
385                 '(objectClass=*)' 2>&1 | awk '/^dn:/ {print "OK"}'`
386         if test "x$RESULT" = "xOK" ; then
387                 RC=0
388                 break
389         fi
390         echo "Waiting 5 seconds for syncrepl to receive changes..."
391         sleep 5
392 done
393
394 if test $RC != 0 ; then
395         echo "ldapsearch failed ($RC)!"
396         test $KILLSERVERS != no && kill -HUP $KILLPIDS
397         exit $RC
398 fi
399
400 echo "Using ldapsearch to read config from the producer..."
401 $LDAPSEARCH -b cn=config -D cn=config -H $URI1 -y $CONFIGPWF  \
402         'objectclass=*' > $MASTEROUT 2>&1
403 RC=$?
404
405 if test $RC != 0 ; then
406         echo "ldapsearch failed at producer ($RC)!"
407         test $KILLSERVERS != no && kill -HUP $KILLPIDS
408         exit $RC
409 fi
410
411 echo "Using ldapsearch to read config from the consumer..."
412 $LDAPSEARCH -b cn=config -D cn=config -H $URI2 -y $CONFIGPWF \
413         'objectclass=*' > $SLAVEOUT 2>&1
414 RC=$?
415
416 if test $RC != 0 ; then
417         echo "ldapsearch failed at consumer ($RC)!"
418         test $KILLSERVERS != no && kill -HUP $KILLPIDS
419         exit $RC
420 fi
421
422 echo "Using ldapsearch to read config from consumer2..."
423 $LDAPSEARCH -b cn=config -D cn=config -H $URI3 -y $CONFIGPWF \
424         'objectclass=*' > $SLAVE2OUT 2>&1
425 RC=$?
426
427 if test $RC != 0 ; then
428         echo "ldapsearch failed at consumer2 ($RC)!"
429         test $KILLSERVERS != no && kill -HUP $KILLPIDS
430         exit $RC
431 fi
432
433 echo "Filtering producer results..."
434 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
435 echo "Filtering consumer results..."
436 . $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
437 echo "Filtering consumer2 results..."
438 . $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
439
440 echo "Comparing retrieved configs from producer and consumer..."
441 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
442
443 if test $? != 0 ; then
444         echo "test failed - producer and consumer configs differ"
445         test $KILLSERVERS != no && kill -HUP $KILLPIDS
446         exit 1
447 fi
448
449 echo "Comparing retrieved configs from producer and consumer2..."
450 $CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
451
452 if test $? != 0 ; then
453         echo "test failed - producer and consumer2 configs differ"
454         test $KILLSERVERS != no && kill -HUP $KILLPIDS
455         exit 1
456 fi
457
458 echo "Using ldapsearch to read all the entries from the producer..."
459 $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD  \
460         'objectclass=*' > $MASTEROUT 2>&1
461 RC=$?
462
463 if test $RC != 0 ; then
464         echo "ldapsearch failed at producer ($RC)!"
465         test $KILLSERVERS != no && kill -HUP $KILLPIDS
466         exit $RC
467 fi
468
469 echo "Using ldapsearch to read all the entries from the consumer..."
470 $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD  \
471         'objectclass=*' > $SLAVEOUT 2>&1
472 RC=$?
473
474 if test $RC != 0 ; then
475         echo "ldapsearch failed at consumer ($RC)!"
476         test $KILLSERVERS != no && kill -HUP $KILLPIDS
477         exit $RC
478 fi
479
480 echo "Using ldapsearch to read all the entries from the consumer2..."
481 $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD  \
482         'objectclass=*' > $SLAVE2OUT 2>&1
483 RC=$?
484
485 if test $RC != 0 ; then
486         echo "ldapsearch failed at consumer2 ($RC)!"
487         test $KILLSERVERS != no && kill -HUP $KILLPIDS
488         exit $RC
489 fi
490
491
492 test $KILLSERVERS != no && kill -HUP $KILLPIDS
493
494 echo "Filtering producer results..."
495 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
496 echo "Filtering consumer results..."
497 . $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
498 echo "Filtering consumer2 results..."
499 . $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
500
501 echo "Comparing retrieved entries from producer and consumer..."
502 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
503
504 if test $? != 0 ; then
505         echo "test failed - producer and consumer databases differ"
506         exit 1
507 fi
508
509 echo "Comparing retrieved entries from producer and consumer2..."
510 $CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
511
512 if test $? != 0 ; then
513         echo "test failed - producer and consumer2 databases differ"
514         exit 1
515 fi
516
517 test $KILLSERVERS != no && wait
518
519 echo "Restarting servers..."
520 echo "Starting producer slapd on TCP/IP port $PORT1..."
521 cd $PRODIR
522 echo "======================= RESTART =======================" >> $LOG1
523 $SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
524 PID=$!
525 if test $WAIT != 0 ; then
526     echo PID $PID
527     read foo
528 fi
529 KILLPIDS="$PID"
530 cd $TESTWD
531 echo "Using ldapsearch to check that producer slapd is running..."
532 for i in 0 1 2 3 4 5; do
533         $LDAPSEARCH -s base -b "" -H $URI1 \
534                 'objectclass=*' > /dev/null 2>&1
535         RC=$?
536         if test $RC = 0 ; then
537                 break
538         fi
539         echo "Waiting 5 seconds for slapd to start..."
540         sleep 5
541 done
542
543 if test $RC != 0 ; then
544         echo "ldapsearch failed ($RC)!"
545         test $KILLSERVERS != no && kill -HUP $KILLPIDS
546         exit $RC
547 fi
548 #exit 0
549 echo "Starting consumer slapd on TCP/IP port $PORT2..."
550 cd $CONDIR
551 echo "======================= RESTART =======================" >> $LOG2
552 $SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
553 SLAVEPID=$!
554 if test $WAIT != 0 ; then
555     echo SLAVEPID $SLAVEPID
556     read foo
557 fi
558 KILLPIDS="$KILLPIDS $SLAVEPID"
559 cd $TESTWD
560
561 sleep 1
562
563 echo "Using ldapsearch to check that consumer slapd is running..."
564 for i in 0 1 2 3 4 5; do
565         $LDAPSEARCH -s base -b "" -H $URI2 \
566                 'objectclass=*' > /dev/null 2>&1
567         RC=$?
568         if test $RC = 0 ; then
569                 break
570         fi
571         echo "Waiting 5 seconds for slapd to start..."
572         sleep 5
573 done
574
575 if test $RC != 0 ; then
576         echo "ldapsearch failed ($RC)!"
577         test $KILLSERVERS != no && kill -HUP $KILLPIDS
578         exit $RC
579 fi
580
581 echo "Starting consumer2 slapd on TCP/IP port $PORT3..."
582 cd $CONDIR2
583 echo "======================= RESTART =======================" >> $LOG3
584 $SLAPD -F ./slapd.d -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
585 SLAVE2PID=$!
586 if test $WAIT != 0 ; then
587     echo SLAVE2PID $SLAVE2PID
588     read foo
589 fi
590 KILLPIDS="$KILLPIDS $SLAVE2PID"
591 cd $TESTWD
592
593 sleep 1
594
595 echo "Using ldapsearch to check that consumer2 slapd is running..."
596 for i in 0 1 2 3 4 5; do
597         $LDAPSEARCH -s base -b "" -H $URI3 \
598                 'objectclass=*' > /dev/null 2>&1
599         RC=$?
600         if test $RC = 0 ; then
601                 break
602         fi
603         echo "Waiting 5 seconds for slapd to start..."
604         sleep 5
605 done
606
607 if test $RC != 0 ; then
608         echo "ldapsearch failed ($RC)!"
609         test $KILLSERVERS != no && kill -HUP $KILLPIDS
610         exit $RC
611 fi
612
613 # Insert modifications and more tests here.
614 SLEEP=10
615 echo "Waiting $SLEEP seconds for servers to resync..."
616 sleep $SLEEP
617
618 test $KILLSERVERS != no && kill -HUP $KILLPIDS
619
620 echo ">>>>> Test succeeded"
621
622 test $KILLSERVERS != no && wait
623
624 exit 0