]> git.sur5r.net Git - openldap/blob - tests/scripts/test050-syncrepl-multimaster
Remove syncrepl timeouts
[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-2008 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 used to configure a timeout here; it was possible for
135 # the servers to attempt to bind to each other while a modify to
136 # cn=config is in progress. When the modify paused the thread pool
137 # neither server wwould progress. The timeout should no longer be
138 # needed since the pool pause code was adjusted.
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"
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"
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"
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"
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"
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"
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"
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"
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"
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 producer database ($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 ldapadd to populate consumer..."
361 $LDAPADD -D "$MANAGERDN" -H $URI2 -w $PASSWD -f $LDIFADD1 \
362         >> $TESTOUT 2>&1
363 RC=$?
364 if test $RC != 0 ; then
365         echo "ldapadd failed for consumer database ($RC)!"
366         test $KILLSERVERS != no && kill -HUP $KILLPIDS
367         exit $RC
368 fi
369
370 SLEEP=20
371 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
372 sleep $SLEEP
373
374 echo "Using ldapsearch to check that syncrepl received database changes..."
375 RC=32
376 for i in 0 1 2 3 4 5; do
377         RESULT=`$LDAPSEARCH -H $URI2 \
378                 -s base -b "cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com" \
379                 '(objectClass=*)' 2>&1 | awk '/^dn:/ {print "OK"}'`
380         if test "x$RESULT" = "xOK" ; then
381                 RC=0
382                 break
383         fi
384         echo "Waiting 5 seconds for syncrepl to receive changes..."
385         sleep 5
386 done
387
388 if test $RC != 0 ; then
389         echo "ldapsearch failed ($RC)!"
390         test $KILLSERVERS != no && kill -HUP $KILLPIDS
391         exit $RC
392 fi
393
394 echo "Using ldapsearch to check that syncrepl received database changes on consumer2..."
395 RC=32
396 for i in 0 1 2 3 4 5; do
397         RESULT=`$LDAPSEARCH -H $URI3 \
398                 -s base -b "cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com" \
399                 '(objectClass=*)' 2>&1 | awk '/^dn:/ {print "OK"}'`
400         if test "x$RESULT" = "xOK" ; then
401                 RC=0
402                 break
403         fi
404         echo "Waiting 5 seconds for syncrepl to receive changes..."
405         sleep 5
406 done
407
408 if test $RC != 0 ; then
409         echo "ldapsearch failed ($RC)!"
410         test $KILLSERVERS != no && kill -HUP $KILLPIDS
411         exit $RC
412 fi
413
414 echo "Using ldapsearch to read config from the producer..."
415 $LDAPSEARCH -b cn=config -D cn=config -H $URI1 -y $CONFIGPWF  \
416         'objectclass=*' > $MASTEROUT 2>&1
417 RC=$?
418
419 if test $RC != 0 ; then
420         echo "ldapsearch failed at producer ($RC)!"
421         test $KILLSERVERS != no && kill -HUP $KILLPIDS
422         exit $RC
423 fi
424
425 echo "Using ldapsearch to read config from the consumer..."
426 $LDAPSEARCH -b cn=config -D cn=config -H $URI2 -y $CONFIGPWF \
427         'objectclass=*' > $SLAVEOUT 2>&1
428 RC=$?
429
430 if test $RC != 0 ; then
431         echo "ldapsearch failed at consumer ($RC)!"
432         test $KILLSERVERS != no && kill -HUP $KILLPIDS
433         exit $RC
434 fi
435
436 echo "Using ldapsearch to read config from consumer2..."
437 $LDAPSEARCH -b cn=config -D cn=config -H $URI3 -y $CONFIGPWF \
438         'objectclass=*' > $SLAVE2OUT 2>&1
439 RC=$?
440
441 if test $RC != 0 ; then
442         echo "ldapsearch failed at consumer2 ($RC)!"
443         test $KILLSERVERS != no && kill -HUP $KILLPIDS
444         exit $RC
445 fi
446
447 echo "Filtering producer results..."
448 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
449 echo "Filtering consumer results..."
450 . $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
451 echo "Filtering consumer2 results..."
452 . $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
453
454 echo "Comparing retrieved configs from producer and consumer..."
455 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
456
457 if test $? != 0 ; then
458         echo "test failed - producer and consumer configs differ"
459         test $KILLSERVERS != no && kill -HUP $KILLPIDS
460         exit 1
461 fi
462
463 echo "Comparing retrieved configs from producer and consumer2..."
464 $CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
465
466 if test $? != 0 ; then
467         echo "test failed - producer and consumer2 configs differ"
468         test $KILLSERVERS != no && kill -HUP $KILLPIDS
469         exit 1
470 fi
471
472 echo "Using ldapsearch to read all the entries from the producer..."
473 $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD  \
474         'objectclass=*' > $MASTEROUT 2>&1
475 RC=$?
476
477 if test $RC != 0 ; then
478         echo "ldapsearch failed at producer ($RC)!"
479         test $KILLSERVERS != no && kill -HUP $KILLPIDS
480         exit $RC
481 fi
482
483 echo "Using ldapsearch to read all the entries from the consumer..."
484 $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD  \
485         'objectclass=*' > $SLAVEOUT 2>&1
486 RC=$?
487
488 if test $RC != 0 ; then
489         echo "ldapsearch failed at consumer ($RC)!"
490         test $KILLSERVERS != no && kill -HUP $KILLPIDS
491         exit $RC
492 fi
493
494 echo "Using ldapsearch to read all the entries from the consumer2..."
495 $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD  \
496         'objectclass=*' > $SLAVE2OUT 2>&1
497 RC=$?
498
499 if test $RC != 0 ; then
500         echo "ldapsearch failed at consumer2 ($RC)!"
501         test $KILLSERVERS != no && kill -HUP $KILLPIDS
502         exit $RC
503 fi
504
505
506 test $KILLSERVERS != no && kill -HUP $KILLPIDS
507
508 echo "Filtering producer results..."
509 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
510 echo "Filtering consumer results..."
511 . $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
512 echo "Filtering consumer2 results..."
513 . $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
514
515 echo "Comparing retrieved entries from producer and consumer..."
516 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
517
518 if test $? != 0 ; then
519         echo "test failed - producer and consumer databases differ"
520         exit 1
521 fi
522
523 echo "Comparing retrieved entries from producer and consumer2..."
524 $CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
525
526 if test $? != 0 ; then
527         echo "test failed - producer and consumer2 databases differ"
528         exit 1
529 fi
530
531 test $KILLSERVERS != no && wait
532
533 echo "Restarting servers..."
534 echo "Starting producer slapd on TCP/IP port $PORT1..."
535 cd $PRODIR
536 echo "======================= RESTART =======================" >> $LOG1
537 $SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
538 PID=$!
539 if test $WAIT != 0 ; then
540     echo PID $PID
541     read foo
542 fi
543 KILLPIDS="$PID"
544 cd $TESTWD
545 echo "Using ldapsearch to check that producer slapd is running..."
546 for i in 0 1 2 3 4 5; do
547         $LDAPSEARCH -s base -b "" -H $URI1 \
548                 'objectclass=*' > /dev/null 2>&1
549         RC=$?
550         if test $RC = 0 ; then
551                 break
552         fi
553         echo "Waiting 5 seconds for slapd to start..."
554         sleep 5
555 done
556
557 if test $RC != 0 ; then
558         echo "ldapsearch failed ($RC)!"
559         test $KILLSERVERS != no && kill -HUP $KILLPIDS
560         exit $RC
561 fi
562 #exit 0
563 echo "Starting consumer slapd on TCP/IP port $PORT2..."
564 cd $CONDIR
565 echo "======================= RESTART =======================" >> $LOG2
566 $SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
567 SLAVEPID=$!
568 if test $WAIT != 0 ; then
569     echo SLAVEPID $SLAVEPID
570     read foo
571 fi
572 KILLPIDS="$KILLPIDS $SLAVEPID"
573 cd $TESTWD
574
575 sleep 1
576
577 echo "Using ldapsearch to check that consumer slapd is running..."
578 for i in 0 1 2 3 4 5; do
579         $LDAPSEARCH -s base -b "" -H $URI2 \
580                 'objectclass=*' > /dev/null 2>&1
581         RC=$?
582         if test $RC = 0 ; then
583                 break
584         fi
585         echo "Waiting 5 seconds for slapd to start..."
586         sleep 5
587 done
588
589 if test $RC != 0 ; then
590         echo "ldapsearch failed ($RC)!"
591         test $KILLSERVERS != no && kill -HUP $KILLPIDS
592         exit $RC
593 fi
594
595 echo "Starting consumer2 slapd on TCP/IP port $PORT3..."
596 cd $CONDIR2
597 echo "======================= RESTART =======================" >> $LOG3
598 $SLAPD -F ./slapd.d -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
599 SLAVE2PID=$!
600 if test $WAIT != 0 ; then
601     echo SLAVE2PID $SLAVE2PID
602     read foo
603 fi
604 KILLPIDS="$KILLPIDS $SLAVE2PID"
605 cd $TESTWD
606
607 sleep 1
608
609 echo "Using ldapsearch to check that consumer2 slapd is running..."
610 for i in 0 1 2 3 4 5; do
611         $LDAPSEARCH -s base -b "" -H $URI3 \
612                 'objectclass=*' > /dev/null 2>&1
613         RC=$?
614         if test $RC = 0 ; then
615                 break
616         fi
617         echo "Waiting 5 seconds for slapd to start..."
618         sleep 5
619 done
620
621 if test $RC != 0 ; then
622         echo "ldapsearch failed ($RC)!"
623         test $KILLSERVERS != no && kill -HUP $KILLPIDS
624         exit $RC
625 fi
626
627 # Insert modifications and more tests here.
628 SLEEP=10
629 echo "Waiting $SLEEP seconds for servers to resync..."
630 sleep $SLEEP
631
632 test $KILLSERVERS != no && kill -HUP $KILLPIDS
633
634 echo ">>>>> Test succeeded"
635
636 test $KILLSERVERS != no && wait
637
638 exit 0