3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 ## Copyright 1998-2014 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>.
17 # test now handles known issues
18 #if test x"$PROXYSYNC" = x ; then
19 # echo "Test disabled; set PROXYSYNC=yes to enable"
23 echo "running defines.sh"
24 . $SRCDIR/scripts/defines.sh
26 if test $BACKLDAP = ldapno; then
27 echo "LDAP backend not available, test skipped"
31 if test $SYNCPROV = syncprovno; then
32 echo "Syncrepl provider overlay not available, test skipped"
36 if test $MONITORDB = no; then
37 echo "Monitor backend not available, test skipped"
41 mkdir -p $TESTDIR $DBDIR1 $DBDIR2
47 # - populate over ldap
48 # - perform some modifies and deleted
49 # - attempt to modify the slave (referral or chain)
50 # - retrieve database over ldap and compare against expected results
53 echo "Starting master slapd on TCP/IP port $PORT1..."
54 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
55 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
57 if test $WAIT != 0 ; then
58 echo MASTERPID $MASTERPID
65 echo "Using ldapsearch to check that master slapd is running..."
66 for i in 0 1 2 3 4 5; do
67 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
68 '(objectClass=*)' > /dev/null 2>&1
70 if test $RC = 0 ; then
73 echo "Waiting 5 seconds for slapd to start..."
77 if test $RC != 0 ; then
78 echo "ldapsearch failed ($RC)!"
79 test $KILLSERVERS != no && kill -HUP $KILLPIDS
83 echo "Using ldapadd to create the context prefix entry in the master..."
84 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
85 $LDIFORDEREDCP > /dev/null 2>&1
87 if test $RC != 0 ; then
88 echo "ldapadd failed ($RC)!"
89 test $KILLSERVERS != no && kill -HUP $KILLPIDS
93 echo "Starting slave slapd on TCP/IP port $PORT2..."
94 . $CONFFILTER $BACKEND $MONITORDB < $RSLAVECONF > $CONF2
95 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
97 if test $WAIT != 0 ; then
98 echo SLAVEPID $SLAVEPID
101 KILLPIDS="$MASTERPID $SLAVEPID"
105 echo "Using ldapsearch to check that slave slapd is running..."
106 for i in 0 1 2 3 4 5; do
107 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
108 '(objectClass=*)' > /dev/null 2>&1
110 if test $RC = 0 ; then
113 echo "Waiting 5 seconds for slapd to start..."
117 if test $RC != 0 ; then
118 echo "ldapsearch failed ($RC)!"
119 test $KILLSERVERS != no && kill -HUP $KILLPIDS
123 echo "Starting proxy slapd on TCP/IP port $PORT3..."
124 . $CONFFILTER $BACKEND $MONITORDB < $PLSRSLAVECONF > $CONF3
125 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
127 if test $WAIT != 0 ; then
128 echo PROXYPID $PROXYPID
131 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
135 echo "Using ldapsearch to check that proxy slapd is running..."
136 for i in 0 1 2 3 4 5; do
137 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
138 '(objectClass=*)' > /dev/null 2>&1
140 if test $RC = 0 || test $RC = 53 ; then
143 echo "Waiting 5 seconds for slapd to start..."
149 echo "ldapsearch should have failed ($RC)!"
150 test $KILLSERVERS != no && kill -HUP $KILLPIDS
156 echo "ldapsearch failed ($RC)!"
157 test $KILLSERVERS != no && kill -HUP $KILLPIDS
163 echo "$CHECK > Using ldapadd to populate the master directory..."
164 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
165 $LDIFORDEREDNOCP > /dev/null 2>&1
167 if test $RC != 0 ; then
168 echo "ldapadd failed ($RC)!"
169 test $KILLSERVERS != no && kill -HUP $KILLPIDS
173 # get master contextCSN
174 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
175 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
177 if test $RC != 0 ; then
178 echo "ldapsearch failed at master ($RC)!"
179 test $KILLSERVERS != no && kill -HUP $KILLPIDS
183 # check slave contextCSN
186 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
187 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
190 if test $RC != 0 ; then
191 echo "ldapsearch failed at slave ($RC)!"
192 test $KILLSERVERS != no && kill -HUP $KILLPIDS
196 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
198 if test $? = 0 ; then
202 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
206 #echo "Using ldapsearch to read all the entries from the master..."
207 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
208 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
211 if test $RC != 0 ; then
212 echo "ldapsearch failed at master ($RC)!"
213 test $KILLSERVERS != no && kill -HUP $KILLPIDS
217 #echo "Using ldapsearch to read all the entries from the slave..."
218 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
219 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
222 if test $RC != 0 ; then
223 echo "ldapsearch failed at slave ($RC)!"
224 test $KILLSERVERS != no && kill -HUP $KILLPIDS
228 #echo "Filtering master results..."
229 $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
230 #echo "Filtering slave results..."
231 $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
233 echo "$CHECK < Comparing retrieved entries from master and slave..."
234 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
236 if test $? != 0 ; then
237 echo "test failed - master and slave databases differ"
238 test $KILLSERVERS != no && kill -HUP $KILLPIDS
242 CHECK=`expr $CHECK + 1`
243 echo "$CHECK > Stopping the provider, sleeping $SLEEP2 seconds and restarting it..."
244 kill -HUP "$MASTERPID"
248 echo "======================= RESTART =======================" >> $LOG1
249 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
251 if test $WAIT != 0 ; then
252 echo MASTERPID $MASTERPID
255 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
259 echo "Using ldapsearch to check that master slapd is running..."
260 for i in 0 1 2 3 4 5; do
261 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
262 '(objectClass=*)' > /dev/null 2>&1
264 if test $RC = 0 ; then
267 echo "Waiting 5 seconds for slapd to start..."
271 if test $RC != 0 ; then
272 echo "ldapsearch failed ($RC)!"
273 test $KILLSERVERS != no && kill -HUP $KILLPIDS
277 echo "Using ldapmodify to modify master directory..."
280 # Do some modifications
283 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
284 $TESTOUT 2>&1 << EOMODS
285 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
296 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
301 dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
304 uniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
305 uniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
308 uniquemember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, dc=example,dc=com
309 uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
311 dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc
317 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
319 objectclass: OpenLDAPperson
323 title: Chief Investigator, ITD
324 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
325 seealso: cn=All Staff, ou=Groups, dc=example,dc=com
327 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
328 description: Very odd
329 facsimiletelephonenumber: +1 313 555 7557
330 telephonenumber: +1 313 555 8343
331 mail: gjensen@mailgw.example.com
332 homephone: +1 313 555 8844
334 dn: ou=Retired, ou=People, dc=example,dc=com
336 objectclass: organizationalUnit
339 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
341 objectclass: OpenLDAPperson
342 cn: Rosco P. Coltrane
345 description: Fat tycoon
347 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
349 newrdn: cn=Rosco P. Coltrane
351 newsuperior: ou=Retired, ou=People, dc=example,dc=com
353 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
358 if test $RC != 0 ; then
359 echo "ldapmodify failed ($RC)!"
360 test $KILLSERVERS != no && kill -HUP $KILLPIDS
364 # get master contextCSN
365 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
366 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
368 if test $RC != 0 ; then
369 echo "ldapsearch failed at master ($RC)!"
370 test $KILLSERVERS != no && kill -HUP $KILLPIDS
374 # check slave contextCSN
376 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
379 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
380 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
383 if test $RC != 0 ; then
384 echo "ldapsearch failed at slave ($RC)!"
385 test $KILLSERVERS != no && kill -HUP $KILLPIDS
389 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
391 if test $? = 0 ; then
396 #echo "Using ldapsearch to read all the entries from the master..."
397 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
398 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
401 if test $RC != 0 ; then
402 echo "ldapsearch failed at master ($RC)!"
403 test $KILLSERVERS != no && kill -HUP $KILLPIDS
407 #echo "Using ldapsearch to read all the entries from the slave..."
408 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
409 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
412 if test $RC != 0 ; then
413 echo "ldapsearch failed at slave ($RC)!"
414 test $KILLSERVERS != no && kill -HUP $KILLPIDS
418 #echo "Filtering master results..."
419 $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
420 #echo "Filtering slave results..."
421 $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
423 echo "$CHECK < Comparing retrieved entries from master and slave..."
424 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
426 if test $? != 0 ; then
427 echo "test failed - master and slave databases differ"
428 test $KILLSERVERS != no && kill -HUP $KILLPIDS
432 CHECK=`expr $CHECK + 1`
433 echo "$CHECK > Stopping proxy to test recovery..."
437 echo "Modifying more entries on the master..."
438 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
439 $TESTOUT 2>&1 << EOMODS
440 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
443 description: proxy is down...
445 dn: cn=James T. Kirk, ou=Retired, ou=People, dc=example,dc=com
447 objectclass: OpenLDAPperson
452 dn: cn=Tiberius J. Hooker, ou=Retired, ou=People, dc=example,dc=com
454 objectclass: OpenLDAPperson
457 cn: Tiberius J. Hooker
461 echo "Restarting proxy..."
462 echo "======================= RESTART =======================" >> $LOG3
463 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
465 if test $WAIT != 0 ; then
466 echo PROXYPID $PROXYPID
469 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
471 # get master contextCSN
472 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
473 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
475 if test $RC != 0 ; then
476 echo "ldapsearch failed at master ($RC)!"
477 test $KILLSERVERS != no && kill -HUP $KILLPIDS
481 # check slave contextCSN
482 for i in 1 2 3 4 5; do
483 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
486 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
487 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
490 if test $RC != 0 ; then
491 echo "ldapsearch failed at slave ($RC)!"
492 test $KILLSERVERS != no && kill -HUP $KILLPIDS
496 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
498 if test $? = 0 ; then
503 #echo "Using ldapsearch to read all the entries from the master..."
504 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
505 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
508 if test $RC != 0 ; then
509 echo "ldapsearch failed at master ($RC)!"
510 test $KILLSERVERS != no && kill -HUP $KILLPIDS
514 #echo "Using ldapsearch to read all the entries from the slave..."
515 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
516 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
519 if test $RC != 0 ; then
520 echo "ldapsearch failed at slave ($RC)!"
521 test $KILLSERVERS != no && kill -HUP $KILLPIDS
525 #echo "Filtering master results..."
526 $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
527 #echo "Filtering slave results..."
528 $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
530 echo "$CHECK < Comparing retrieved entries from master and slave..."
531 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
533 if test $? != 0 ; then
534 echo "test failed - master and slave databases differ"
535 test $KILLSERVERS != no && kill -HUP $KILLPIDS
539 CHECK=`expr $CHECK + 1`
540 echo "$CHECK > Try updating the slave slapd..."
541 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD > \
542 $TESTOUT 2>&1 << EOMODS
543 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
546 description: This write must fail because directed to a shadow context,
547 description: unless the chain overlay is configured appropriately ;)
552 if test $RC != 0 ; then
553 echo "ldapmodify failed ($RC)!"
554 test $KILLSERVERS != no && kill -HUP $KILLPIDS
558 # get master contextCSN
559 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
560 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
562 if test $RC != 0 ; then
563 echo "ldapsearch failed at master ($RC)!"
564 test $KILLSERVERS != no && kill -HUP $KILLPIDS
568 # check slave contextCSN
572 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
573 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
576 if test $RC != 0 ; then
577 echo "ldapsearch failed at slave ($RC)!"
578 test $KILLSERVERS != no && kill -HUP $KILLPIDS
582 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
584 if test $? = 0 ; then
588 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
592 #echo "Using ldapsearch to read all the entries from the master..."
593 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
594 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
597 if test $RC != 0 ; then
598 echo "ldapsearch failed at master ($RC)!"
599 test $KILLSERVERS != no && kill -HUP $KILLPIDS
603 #echo "Using ldapsearch to read all the entries from the slave..."
604 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
605 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
608 if test $RC != 0 ; then
609 echo "ldapsearch failed at slave ($RC)!"
610 test $KILLSERVERS != no && kill -HUP $KILLPIDS
614 #echo "Filtering master results..."
615 $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
616 #echo "Filtering slave results..."
617 $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
619 echo "$CHECK < Comparing retrieved entries from master and slave..."
620 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
622 if test $? != 0 ; then
623 echo "test failed - master and slave databases differ"
624 test $KILLSERVERS != no && kill -HUP $KILLPIDS
628 CHECK=`expr $CHECK + 1`
629 echo "$CHECK > Stopping consumer to test recovery..."
633 echo "Modifying more entries on the master..."
634 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
635 $TESTOUT 2>&1 << EOMODS
636 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
643 echo "Waiting $SLEEP2 seconds for syncrepl to retry..."
646 echo "Restarting consumer..."
647 echo "======================= RESTART =======================" >> $LOG2
648 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
650 if test $WAIT != 0 ; then
651 echo SLAVEPID $SLAVEPID
654 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
656 # get master contextCSN
657 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
658 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
660 if test $RC != 0 ; then
661 echo "ldapsearch failed at master ($RC)!"
662 test $KILLSERVERS != no && kill -HUP $KILLPIDS
666 # check slave contextCSN
668 for i in 1 2 3 4 5; do
669 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
672 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
673 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
676 if test $RC != 0 ; then
677 echo "ldapsearch failed at slave ($RC)!"
678 test $KILLSERVERS != no && kill -HUP $KILLPIDS
682 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
684 if test $? = 0 ; then
689 #echo "Using ldapsearch to read all the entries from the master..."
690 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
691 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
694 if test $RC != 0 ; then
695 echo "ldapsearch failed at master ($RC)!"
696 test $KILLSERVERS != no && kill -HUP $KILLPIDS
700 #echo "Using ldapsearch to read all the entries from the slave..."
701 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
702 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
705 if test $RC != 0 ; then
706 echo "ldapsearch failed at slave ($RC)!"
707 test $KILLSERVERS != no && kill -HUP $KILLPIDS
711 #echo "Filtering master results..."
712 $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
713 #echo "Filtering slave results..."
714 $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
716 echo "$CHECK < Comparing retrieved entries from master and slave..."
717 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
719 if test $? != 0 ; then
720 # FIXME: keep the original workaround in place, in case we needed again
722 echo "test failed - master and slave databases differ"
723 test $KILLSERVERS != no && kill -HUP $KILLPIDS
727 echo " test failed - master and slave databases differ (ignored by now)"
728 echo " Stopping proxy to see if it auto-recovers..."
732 echo " ${CHECK}.1 > Restarting proxy..."
733 echo "======================= RESTART =======================" >> $LOG3
734 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
736 if test $WAIT != 0 ; then
737 echo PROXYPID $PROXYPID
740 KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
742 echo " Waiting $SLEEP2 seconds for syncrepl to receive changes..."
745 #echo "Using ldapsearch to read all the entries from the slave..."
746 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
747 '(objectClass=*)' > "${SLAVEOUT}.5.1" 2>&1
750 if test $RC != 0 ; then
751 echo " ldapsearch failed at slave ($RC)!"
752 test $KILLSERVERS != no && kill -HUP $KILLPIDS
756 #echo "Filtering slave results..."
757 $LDIFFILTER < "${SLAVEOUT}.5.1" > $SLAVEFLT
759 echo " ${CHECK}.1 < Comparing retrieved entries from master and slave..."
760 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
762 if test $? != 0 ; then
763 echo " test failed - master and slave databases differ"
764 test $KILLSERVERS != no && kill -HUP $KILLPIDS
770 # Modifications formerly known to fail
772 CHECK=`expr $CHECK + 1`
773 echo "$CHECK > Performing modifications that were formerly known to fail..."
774 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
775 $TESTOUT 2>&1 << EOMODS
776 # First, back out previous change
777 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
782 # From now on, perform modifications that were formerly known to fail
783 dn: cn=All Staff,ou=Groups,dc=example,dc=com
790 if test $RC != 0 ; then
791 echo "ldapmodify failed ($RC)!"
792 test $KILLSERVERS != no && kill -HUP $KILLPIDS
796 # get master contextCSN
797 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
798 -s base '(objectClass=*)' contextCSN > "${MASTEROUT}.$CHECK" 2>&1
800 if test $RC != 0 ; then
801 echo "ldapsearch failed at master ($RC)!"
802 test $KILLSERVERS != no && kill -HUP $KILLPIDS
806 # check slave contextCSN
809 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
810 -s base '(objectClass=*)' contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
813 if test $RC != 0 ; then
814 echo "ldapsearch failed at slave ($RC)!"
815 test $KILLSERVERS != no && kill -HUP $KILLPIDS
819 $CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
821 if test $? = 0 ; then
825 echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
829 #echo "Using ldapsearch to read all the entries from the master..."
830 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
831 '(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
834 if test $RC != 0 ; then
835 echo "ldapsearch failed at master ($RC)!"
836 test $KILLSERVERS != no && kill -HUP $KILLPIDS
840 #echo "Using ldapsearch to read all the entries from the slave..."
841 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
842 '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
845 if test $RC != 0 ; then
846 echo "ldapsearch failed at slave ($RC)!"
847 test $KILLSERVERS != no && kill -HUP $KILLPIDS
851 #echo "Filtering master results..."
852 $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
853 #echo "Filtering slave results..."
854 $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
856 echo "$CHECK < Comparing retrieved entries from master and slave..."
857 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
859 if test $? != 0 ; then
860 echo "test failed - master and slave databases differ (ignored by now)"
861 #echo "test failed - master and slave databases differ"
862 #test $KILLSERVERS != no && kill -HUP $KILLPIDS
866 test $KILLSERVERS != no && kill -HUP $KILLPIDS
868 echo ">>>>> Test succeeded"
870 test $KILLSERVERS != no && wait