2 # $OpenLDAP: pkg/ldap/tests/scripts/test045-syncreplication-proxied,v 1.14.2.6 2008/02/11 23:26:51 kurt Exp $
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2008 The OpenLDAP Foundation.
6 ## All rights reserved.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
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>.
16 if test "$BACKEND" != "bdb" && test "$BACKEND" != "hdb" ; then
17 echo "Test does not support $BACKEND"
21 # test now handles known issues
22 #if test x"$PROXYSYNC" = x ; then
23 # echo "Test disabled; set PROXYSYNC=yes to enable"
27 echo "running defines.sh"
28 .
$SRCDIR/scripts
/defines.sh
30 if test $BACKLDAP = ldapno
; then
31 echo "LDAP backend not available, test skipped"
35 if test $SYNCPROV = syncprovno
; then
36 echo "Syncrepl provider overlay not available, test skipped"
40 if test $MONITORDB = no
; then
41 echo "Monitor backend not available, test skipped"
45 mkdir
-p $TESTDIR $DBDIR1 $DBDIR2
51 # - populate over ldap
52 # - perform some modifies and deleted
53 # - attempt to modify the slave (referral or chain)
54 # - retrieve database over ldap and compare against expected results
57 echo "Starting master slapd on TCP/IP port $PORT1..."
58 .
$CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
59 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
61 if test $WAIT != 0 ; then
62 echo MASTERPID
$MASTERPID
69 echo "Using ldapsearch to check that master slapd is running..."
70 for i
in 0 1 2 3 4 5; do
71 $LDAPSEARCH -s base
-b "$MONITOR" -h $LOCALHOST -p $PORT1 \
72 '(objectClass=*)' > /dev
/null
2>&1
74 if test $RC = 0 ; then
77 echo "Waiting 5 seconds for slapd to start..."
81 if test $RC != 0 ; then
82 echo "ldapsearch failed ($RC)!"
83 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
87 echo "Using ldapadd to create the context prefix entry in the master..."
88 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
89 $LDIFORDEREDCP > /dev
/null
2>&1
91 if test $RC != 0 ; then
92 echo "ldapadd failed ($RC)!"
93 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
97 echo "Starting slave slapd on TCP/IP port $PORT2..."
98 .
$CONFFILTER $BACKEND $MONITORDB < $RSLAVECONF > $CONF2
99 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
101 if test $WAIT != 0 ; then
102 echo SLAVEPID
$SLAVEPID
105 KILLPIDS
="$MASTERPID $SLAVEPID"
109 echo "Using ldapsearch to check that slave slapd is running..."
110 for i
in 0 1 2 3 4 5; do
111 $LDAPSEARCH -s base
-b "$MONITOR" -h $LOCALHOST -p $PORT2 \
112 '(objectClass=*)' > /dev
/null
2>&1
114 if test $RC = 0 ; then
117 echo "Waiting 5 seconds for slapd to start..."
121 if test $RC != 0 ; then
122 echo "ldapsearch failed ($RC)!"
123 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
127 echo "Starting proxy slapd on TCP/IP port $PORT3..."
128 .
$CONFFILTER $BACKEND $MONITORDB < $PLSRSLAVECONF > $CONF3
129 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
131 if test $WAIT != 0 ; then
132 echo PROXYPID
$PROXYPID
135 KILLPIDS
="$MASTERPID $SLAVEPID $PROXYPID"
139 echo "Using ldapsearch to check that proxy slapd is running..."
140 for i
in 0 1 2 3 4 5; do
141 $LDAPSEARCH -s base
-b "$MONITOR" -h $LOCALHOST -p $PORT3 \
142 '(objectClass=*)' > /dev
/null
2>&1
144 if test $RC = 0 ||
test $RC = 53 ; then
147 echo "Waiting 5 seconds for slapd to start..."
153 echo "ldapsearch should have failed ($RC)!"
154 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
160 echo "ldapsearch failed ($RC)!"
161 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
167 echo "$CHECK > Using ldapadd to populate the master directory..."
168 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
169 $LDIFORDEREDNOCP > /dev
/null
2>&1
171 if test $RC != 0 ; then
172 echo "ldapadd failed ($RC)!"
173 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
177 # get master contextCSN
178 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
179 '(objectClass=*)' -s base contextCSN
> "${MASTEROUT}.$CHECK" 2>&1
181 if test $RC != 0 ; then
182 echo "ldapsearch failed at master ($RC)!"
183 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
187 # check slave contextCSN
190 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
191 '(objectClass=*)' -s base contextCSN
> "${SLAVEOUT}.$CHECK" 2>&1
194 if test $RC != 0 ; then
195 echo "ldapsearch failed at slave ($RC)!"
196 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
200 $CMP ${MASTEROUT}.
$CHECK ${SLAVEOUT}.
$CHECK > $CMPOUT
202 if test $?
= 0 ; then
207 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
211 #echo "Using ldapsearch to read all the entries from the master..."
212 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
213 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
216 if test $RC != 0 ; then
217 echo "ldapsearch failed at master ($RC)!"
218 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
222 #echo "Using ldapsearch to read all the entries from the slave..."
223 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
224 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
227 if test $RC != 0 ; then
228 echo "ldapsearch failed at slave ($RC)!"
229 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
233 #echo "Filtering master results..."
234 .
$LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
235 #echo "Filtering slave results..."
236 .
$LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
238 echo "$CHECK < Comparing retrieved entries from master and slave..."
239 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
241 if test $?
!= 0 ; then
242 echo "test failed - master and slave databases differ"
243 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
247 CHECK
=`expr $CHECK + 1`
249 echo "$CHECK > Stopping the provider, sleeping $SLEEP seconds and restarting it..."
250 kill -HUP "$MASTERPID"
254 echo "======================= RESTART =======================" >> $LOG1
255 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
257 if test $WAIT != 0 ; then
258 echo MASTERPID
$MASTERPID
261 KILLPIDS
="$MASTERPID $SLAVEPID $PROXYPID"
265 echo "Using ldapsearch to check that master slapd is running..."
266 for i
in 0 1 2 3 4 5; do
267 $LDAPSEARCH -s base
-b "$MONITOR" -h $LOCALHOST -p $PORT1 \
268 '(objectClass=*)' > /dev
/null
2>&1
270 if test $RC = 0 ; then
273 echo "Waiting 5 seconds for slapd to start..."
277 if test $RC != 0 ; then
278 echo "ldapsearch failed ($RC)!"
279 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
283 echo "Using ldapmodify to modify master directory..."
286 # Do some modifications
289 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
290 $TESTOUT 2>&1 << EOMODS
291 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
302 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
307 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
310 uniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
311 uniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
314 uniquemember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, dc=example,dc=com
315 uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
317 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc
323 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
325 objectclass: OpenLDAPperson
329 title: Chief Investigator, ITD
330 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
331 seealso: cn=All Staff, ou=Groups, dc=example,dc=com
333 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
334 description: Very odd
335 facsimiletelephonenumber: +1 313 555 7557
336 telephonenumber: +1 313 555 8343
337 mail: gjensen@mailgw.example.com
338 homephone: +1 313 555 8844
340 dn: ou=Retired, ou=People, dc=example,dc=com
342 objectclass: organizationalUnit
345 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
347 objectclass: OpenLDAPperson
348 cn: Rosco P. Coltrane
351 description: Fat tycoon
353 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
355 newrdn: cn=Rosco P. Coltrane
357 newsuperior: ou=Retired, ou=People, dc=example,dc=com
359 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
364 if test $RC != 0 ; then
365 echo "ldapmodify failed ($RC)!"
366 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
370 # get master contextCSN
371 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
372 '(objectClass=*)' -s base contextCSN
> "${MASTEROUT}.$CHECK" 2>&1
374 if test $RC != 0 ; then
375 echo "ldapsearch failed at master ($RC)!"
376 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
380 # check slave contextCSN
383 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
386 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
387 '(objectClass=*)' -s base contextCSN
> "${SLAVEOUT}.$CHECK" 2>&1
390 if test $RC != 0 ; then
391 echo "ldapsearch failed at slave ($RC)!"
392 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
396 $CMP ${MASTEROUT}.
$CHECK ${SLAVEOUT}.
$CHECK > $CMPOUT
398 if test $?
= 0 ; then
403 #echo "Using ldapsearch to read all the entries from the master..."
404 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
405 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
408 if test $RC != 0 ; then
409 echo "ldapsearch failed at master ($RC)!"
410 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
414 #echo "Using ldapsearch to read all the entries from the slave..."
415 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
416 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
419 if test $RC != 0 ; then
420 echo "ldapsearch failed at slave ($RC)!"
421 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
425 #echo "Filtering master results..."
426 .
$LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
427 #echo "Filtering slave results..."
428 .
$LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
430 echo "$CHECK < Comparing retrieved entries from master and slave..."
431 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
433 if test $?
!= 0 ; then
434 echo "test failed - master and slave databases differ"
435 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
439 CHECK
=`expr $CHECK + 1`
440 echo "$CHECK > Stopping proxy to test recovery..."
444 echo "Modifying more entries on the master..."
445 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
446 $TESTOUT 2>&1 << EOMODS
447 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
450 description: proxy is down...
452 dn: cn=James T. Kirk, ou=Retired, ou=People, dc=example,dc=com
454 objectclass: OpenLDAPperson
459 dn: cn=Tiberius J. Hooker, ou=Retired, ou=People, dc=example,dc=com
461 objectclass: OpenLDAPperson
464 cn: Tiberius J. Hooker
468 echo "Restarting proxy..."
469 echo "======================= RESTART =======================" >> $LOG3
470 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
472 if test $WAIT != 0 ; then
473 echo PROXYPID
$PROXYPID
476 KILLPIDS
="$MASTERPID $SLAVEPID $PROXYPID"
478 # get master contextCSN
479 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
480 '(objectClass=*)' -s base contextCSN
> "${MASTEROUT}.$CHECK" 2>&1
482 if test $RC != 0 ; then
483 echo "ldapsearch failed at master ($RC)!"
484 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
488 # check slave contextCSN
489 for i
in 1 2 3 4 5; do
491 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
494 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
495 '(objectClass=*)' -s base contextCSN
> "${SLAVEOUT}.$CHECK" 2>&1
498 if test $RC != 0 ; then
499 echo "ldapsearch failed at slave ($RC)!"
500 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
504 $CMP ${MASTEROUT}.
$CHECK ${SLAVEOUT}.
$CHECK > $CMPOUT
506 if test $?
= 0 ; then
511 #echo "Using ldapsearch to read all the entries from the master..."
512 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
513 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
516 if test $RC != 0 ; then
517 echo "ldapsearch failed at master ($RC)!"
518 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
522 #echo "Using ldapsearch to read all the entries from the slave..."
523 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
524 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
527 if test $RC != 0 ; then
528 echo "ldapsearch failed at slave ($RC)!"
529 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
533 #echo "Filtering master results..."
534 .
$LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
535 #echo "Filtering slave results..."
536 .
$LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
538 echo "$CHECK < Comparing retrieved entries from master and slave..."
539 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
541 if test $?
!= 0 ; then
542 echo "test failed - master and slave databases differ"
543 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
547 CHECK
=`expr $CHECK + 1`
548 echo "$CHECK > Try updating the slave slapd..."
549 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD > \
550 $TESTOUT 2>&1 << EOMODS
551 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
554 description: This write must fail because directed to a shadow context,
555 description: unless the chain overlay is configured appropriately ;)
560 if test $RC != 0 ; then
561 echo "ldapmodify failed ($RC)!"
562 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
566 # get master contextCSN
567 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
568 '(objectClass=*)' -s base contextCSN
> "${MASTEROUT}.$CHECK" 2>&1
570 if test $RC != 0 ; then
571 echo "ldapsearch failed at master ($RC)!"
572 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
576 # check slave contextCSN
580 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
581 '(objectClass=*)' -s base contextCSN
> "${SLAVEOUT}.$CHECK" 2>&1
584 if test $RC != 0 ; then
585 echo "ldapsearch failed at slave ($RC)!"
586 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
590 $CMP ${MASTEROUT}.
$CHECK ${SLAVEOUT}.
$CHECK > $CMPOUT
592 if test $?
= 0 ; then
597 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
601 #echo "Using ldapsearch to read all the entries from the master..."
602 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
603 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
606 if test $RC != 0 ; then
607 echo "ldapsearch failed at master ($RC)!"
608 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
612 #echo "Using ldapsearch to read all the entries from the slave..."
613 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
614 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
617 if test $RC != 0 ; then
618 echo "ldapsearch failed at slave ($RC)!"
619 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
623 #echo "Filtering master results..."
624 .
$LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
625 #echo "Filtering slave results..."
626 .
$LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
628 echo "$CHECK < Comparing retrieved entries from master and slave..."
629 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
631 if test $?
!= 0 ; then
632 echo "test failed - master and slave databases differ"
633 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
637 CHECK
=`expr $CHECK + 1`
638 echo "$CHECK > Stopping consumer to test recovery..."
642 echo "Modifying more entries on the master..."
643 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
644 $TESTOUT 2>&1 << EOMODS
645 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
653 echo "Waiting $SLEEP seconds for syncrepl to retry..."
656 echo "Restarting consumer..."
657 echo "======================= RESTART =======================" >> $LOG2
658 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
660 if test $WAIT != 0 ; then
661 echo SLAVEPID
$SLAVEPID
664 KILLPIDS
="$MASTERPID $SLAVEPID $PROXYPID"
666 # get master contextCSN
667 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
668 '(objectClass=*)' -s base contextCSN
> "${MASTEROUT}.$CHECK" 2>&1
670 if test $RC != 0 ; then
671 echo "ldapsearch failed at master ($RC)!"
672 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
676 # check slave contextCSN
678 for i
in 1 2 3 4 5; do
680 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
683 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
684 '(objectClass=*)' -s base contextCSN
> "${SLAVEOUT}.$CHECK" 2>&1
687 if test $RC != 0 ; then
688 echo "ldapsearch failed at slave ($RC)!"
689 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
693 $CMP ${MASTEROUT}.
$CHECK ${SLAVEOUT}.
$CHECK > $CMPOUT
695 if test $?
= 0 ; then
700 #echo "Using ldapsearch to read all the entries from the master..."
701 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
702 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
705 if test $RC != 0 ; then
706 echo "ldapsearch failed at master ($RC)!"
707 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
711 #echo "Using ldapsearch to read all the entries from the slave..."
712 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
713 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
716 if test $RC != 0 ; then
717 echo "ldapsearch failed at slave ($RC)!"
718 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
722 #echo "Filtering master results..."
723 .
$LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
724 #echo "Filtering slave results..."
725 .
$LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
727 echo "$CHECK < Comparing retrieved entries from master and slave..."
728 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
730 if test $?
!= 0 ; then
731 # FIXME: keep the original workaround in place, in case we needed again
733 echo "test failed - master and slave databases differ"
734 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
738 echo " test failed - master and slave databases differ (ignored by now)"
739 echo " Stopping proxy to see if it auto-recovers..."
743 echo " ${CHECK}.1 > Restarting proxy..."
744 echo "======================= RESTART =======================" >> $LOG3
745 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
747 if test $WAIT != 0 ; then
748 echo PROXYPID
$PROXYPID
751 KILLPIDS
="$MASTERPID $SLAVEPID $PROXYPID"
754 echo " Waiting $SLEEP seconds for syncrepl to receive changes..."
757 #echo "Using ldapsearch to read all the entries from the slave..."
758 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
759 '(objectClass=*)' > "${SLAVEOUT}.5.1" 2>&1
762 if test $RC != 0 ; then
763 echo " ldapsearch failed at slave ($RC)!"
764 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
768 #echo "Filtering slave results..."
769 .
$LDIFFILTER < "${SLAVEOUT}.5.1" > $SLAVEFLT
771 echo " ${CHECK}.1 < Comparing retrieved entries from master and slave..."
772 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
774 if test $?
!= 0 ; then
775 echo " test failed - master and slave databases differ"
776 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
782 # Modifications formerly known to fail
784 CHECK
=`expr $CHECK + 1`
785 echo "$CHECK > Performing modifications that were formerly known to fail..."
786 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
787 $TESTOUT 2>&1 << EOMODS
788 # First, back out previous change
789 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
794 # From now on, perform modifications that were formerly known to fail
795 dn: cn=All Staff,ou=Groups,dc=example,dc=com
802 if test $RC != 0 ; then
803 echo "ldapmodify failed ($RC)!"
804 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
808 # get master contextCSN
809 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
810 '(objectClass=*)' -s base contextCSN
> "${MASTEROUT}.$CHECK" 2>&1
812 if test $RC != 0 ; then
813 echo "ldapsearch failed at master ($RC)!"
814 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
818 # check slave contextCSN
821 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
822 '(objectClass=*)' -s base contextCSN
> "${SLAVEOUT}.$CHECK" 2>&1
825 if test $RC != 0 ; then
826 echo "ldapsearch failed at slave ($RC)!"
827 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
831 $CMP ${MASTEROUT}.
$CHECK ${SLAVEOUT}.
$CHECK > $CMPOUT
833 if test $?
= 0 ; then
838 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
842 #echo "Using ldapsearch to read all the entries from the master..."
843 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
844 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
847 if test $RC != 0 ; then
848 echo "ldapsearch failed at master ($RC)!"
849 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
853 #echo "Using ldapsearch to read all the entries from the slave..."
854 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
855 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
858 if test $RC != 0 ; then
859 echo "ldapsearch failed at slave ($RC)!"
860 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
864 #echo "Filtering master results..."
865 .
$LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
866 #echo "Filtering slave results..."
867 .
$LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
869 echo "$CHECK < Comparing retrieved entries from master and slave..."
870 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
872 if test $?
!= 0 ; then
873 echo "test failed - master and slave databases differ (ignored by now)"
874 #echo "test failed - master and slave databases differ"
875 #test $KILLSERVERS != no && kill -HUP $KILLPIDS
879 test $KILLSERVERS != no
&& kill -HUP $KILLPIDS
881 echo ">>>>> Test succeeded"
883 test $KILLSERVERS != no
&& wait