Home | History | Annotate | Line # | Download | only in scripts
test045-syncreplication-proxied revision 1.1
      1  1.1  lukem #! /bin/sh
      2  1.1  lukem # $OpenLDAP: pkg/ldap/tests/scripts/test045-syncreplication-proxied,v 1.14.2.6 2008/02/11 23:26:51 kurt Exp $
      3  1.1  lukem ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
      4  1.1  lukem ##
      5  1.1  lukem ## Copyright 1998-2008 The OpenLDAP Foundation.
      6  1.1  lukem ## All rights reserved.
      7  1.1  lukem ##
      8  1.1  lukem ## Redistribution and use in source and binary forms, with or without
      9  1.1  lukem ## modification, are permitted only as authorized by the OpenLDAP
     10  1.1  lukem ## Public License.
     11  1.1  lukem ##
     12  1.1  lukem ## A copy of this license is available in the file LICENSE in the
     13  1.1  lukem ## top-level directory of the distribution or, alternatively, at
     14  1.1  lukem ## <http://www.OpenLDAP.org/license.html>.
     15  1.1  lukem 
     16  1.1  lukem if test "$BACKEND" != "bdb" && test "$BACKEND" != "hdb" ; then
     17  1.1  lukem 	echo "Test does not support $BACKEND"
     18  1.1  lukem 	exit 0
     19  1.1  lukem fi
     20  1.1  lukem 
     21  1.1  lukem # test now handles known issues
     22  1.1  lukem #if test x"$PROXYSYNC" = x ; then
     23  1.1  lukem #	echo "Test disabled; set PROXYSYNC=yes to enable"
     24  1.1  lukem #	exit 0
     25  1.1  lukem #fi
     26  1.1  lukem 
     27  1.1  lukem echo "running defines.sh"
     28  1.1  lukem . $SRCDIR/scripts/defines.sh
     29  1.1  lukem 
     30  1.1  lukem if test $BACKLDAP = ldapno; then 
     31  1.1  lukem 	echo "LDAP backend not available, test skipped"
     32  1.1  lukem 	exit 0
     33  1.1  lukem fi 
     34  1.1  lukem 
     35  1.1  lukem if test $SYNCPROV = syncprovno; then 
     36  1.1  lukem 	echo "Syncrepl provider overlay not available, test skipped"
     37  1.1  lukem 	exit 0
     38  1.1  lukem fi 
     39  1.1  lukem 
     40  1.1  lukem if test $MONITORDB = no; then 
     41  1.1  lukem 	echo "Monitor backend not available, test skipped"
     42  1.1  lukem 	exit 0
     43  1.1  lukem fi 
     44  1.1  lukem 
     45  1.1  lukem mkdir -p $TESTDIR $DBDIR1 $DBDIR2
     46  1.1  lukem 
     47  1.1  lukem #
     48  1.1  lukem # Test replication:
     49  1.1  lukem # - start master
     50  1.1  lukem # - start slave
     51  1.1  lukem # - populate over ldap
     52  1.1  lukem # - perform some modifies and deleted
     53  1.1  lukem # - attempt to modify the slave (referral or chain)
     54  1.1  lukem # - retrieve database over ldap and compare against expected results
     55  1.1  lukem #
     56  1.1  lukem 
     57  1.1  lukem echo "Starting master slapd on TCP/IP port $PORT1..."
     58  1.1  lukem . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
     59  1.1  lukem $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
     60  1.1  lukem MASTERPID=$!
     61  1.1  lukem if test $WAIT != 0 ; then
     62  1.1  lukem     echo MASTERPID $MASTERPID
     63  1.1  lukem     read foo
     64  1.1  lukem fi
     65  1.1  lukem KILLPIDS="$MASTERPID"
     66  1.1  lukem 
     67  1.1  lukem sleep 1
     68  1.1  lukem 
     69  1.1  lukem echo "Using ldapsearch to check that master slapd is running..."
     70  1.1  lukem for i in 0 1 2 3 4 5; do
     71  1.1  lukem 	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
     72  1.1  lukem 		'(objectClass=*)' > /dev/null 2>&1
     73  1.1  lukem 	RC=$?
     74  1.1  lukem 	if test $RC = 0 ; then
     75  1.1  lukem 		break
     76  1.1  lukem 	fi
     77  1.1  lukem 	echo "Waiting 5 seconds for slapd to start..."
     78  1.1  lukem 	sleep 5
     79  1.1  lukem done
     80  1.1  lukem 
     81  1.1  lukem if test $RC != 0 ; then
     82  1.1  lukem 	echo "ldapsearch failed ($RC)!"
     83  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
     84  1.1  lukem 	exit $RC
     85  1.1  lukem fi
     86  1.1  lukem 
     87  1.1  lukem echo "Using ldapadd to create the context prefix entry in the master..."
     88  1.1  lukem $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
     89  1.1  lukem 	$LDIFORDEREDCP > /dev/null 2>&1
     90  1.1  lukem RC=$?
     91  1.1  lukem if test $RC != 0 ; then
     92  1.1  lukem 	echo "ldapadd failed ($RC)!"
     93  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
     94  1.1  lukem 	exit $RC
     95  1.1  lukem fi
     96  1.1  lukem 
     97  1.1  lukem echo "Starting slave slapd on TCP/IP port $PORT2..."
     98  1.1  lukem . $CONFFILTER $BACKEND $MONITORDB < $RSLAVECONF > $CONF2
     99  1.1  lukem $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
    100  1.1  lukem SLAVEPID=$!
    101  1.1  lukem if test $WAIT != 0 ; then
    102  1.1  lukem     echo SLAVEPID $SLAVEPID
    103  1.1  lukem     read foo
    104  1.1  lukem fi
    105  1.1  lukem KILLPIDS="$MASTERPID $SLAVEPID"
    106  1.1  lukem 
    107  1.1  lukem sleep 1
    108  1.1  lukem 
    109  1.1  lukem echo "Using ldapsearch to check that slave slapd is running..."
    110  1.1  lukem for i in 0 1 2 3 4 5; do
    111  1.1  lukem 	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
    112  1.1  lukem 		'(objectClass=*)' > /dev/null 2>&1
    113  1.1  lukem 	RC=$?
    114  1.1  lukem 	if test $RC = 0 ; then
    115  1.1  lukem 		break
    116  1.1  lukem 	fi
    117  1.1  lukem 	echo "Waiting 5 seconds for slapd to start..."
    118  1.1  lukem 	sleep 5
    119  1.1  lukem done
    120  1.1  lukem 
    121  1.1  lukem if test $RC != 0 ; then
    122  1.1  lukem 	echo "ldapsearch failed ($RC)!"
    123  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    124  1.1  lukem 	exit $RC
    125  1.1  lukem fi
    126  1.1  lukem 
    127  1.1  lukem echo "Starting proxy slapd on TCP/IP port $PORT3..."
    128  1.1  lukem . $CONFFILTER $BACKEND $MONITORDB < $PLSRSLAVECONF > $CONF3
    129  1.1  lukem $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
    130  1.1  lukem PROXYPID=$!
    131  1.1  lukem if test $WAIT != 0 ; then
    132  1.1  lukem     echo PROXYPID $PROXYPID
    133  1.1  lukem     read foo
    134  1.1  lukem fi
    135  1.1  lukem KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
    136  1.1  lukem 
    137  1.1  lukem sleep 1
    138  1.1  lukem 
    139  1.1  lukem echo "Using ldapsearch to check that proxy slapd is running..."
    140  1.1  lukem for i in 0 1 2 3 4 5; do
    141  1.1  lukem 	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
    142  1.1  lukem 		'(objectClass=*)' > /dev/null 2>&1
    143  1.1  lukem 	RC=$?
    144  1.1  lukem 	if test $RC = 0 || test $RC = 53 ; then
    145  1.1  lukem 		break
    146  1.1  lukem 	fi
    147  1.1  lukem 	echo "Waiting 5 seconds for slapd to start..."
    148  1.1  lukem 	sleep 5
    149  1.1  lukem done
    150  1.1  lukem 
    151  1.1  lukem case $RC in
    152  1.1  lukem 0 )
    153  1.1  lukem 	echo "ldapsearch should have failed ($RC)!"
    154  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    155  1.1  lukem 	exit -1
    156  1.1  lukem 	;;
    157  1.1  lukem 53)
    158  1.1  lukem 	;;
    159  1.1  lukem *)
    160  1.1  lukem 	echo "ldapsearch failed ($RC)!"
    161  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    162  1.1  lukem 	exit $RC
    163  1.1  lukem 	;;
    164  1.1  lukem esac
    165  1.1  lukem 
    166  1.1  lukem CHECK=1
    167  1.1  lukem echo "$CHECK > Using ldapadd to populate the master directory..."
    168  1.1  lukem $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
    169  1.1  lukem 	$LDIFORDEREDNOCP > /dev/null 2>&1
    170  1.1  lukem RC=$?
    171  1.1  lukem if test $RC != 0 ; then
    172  1.1  lukem 	echo "ldapadd failed ($RC)!"
    173  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    174  1.1  lukem 	exit $RC
    175  1.1  lukem fi
    176  1.1  lukem 
    177  1.1  lukem # get master contextCSN
    178  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    179  1.1  lukem 	'(objectClass=*)' -s base contextCSN > "${MASTEROUT}.$CHECK" 2>&1
    180  1.1  lukem RC=$?
    181  1.1  lukem if test $RC != 0 ; then
    182  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    183  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    184  1.1  lukem 	exit $RC
    185  1.1  lukem fi
    186  1.1  lukem 
    187  1.1  lukem # check slave contextCSN
    188  1.1  lukem sleep 1
    189  1.1  lukem for i in 1 2 3; do
    190  1.1  lukem 	$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    191  1.1  lukem 		'(objectClass=*)' -s base contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
    192  1.1  lukem 	RC=$?
    193  1.1  lukem 
    194  1.1  lukem 	if test $RC != 0 ; then
    195  1.1  lukem 		echo "ldapsearch failed at slave ($RC)!"
    196  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    197  1.1  lukem 		exit $RC
    198  1.1  lukem 	fi
    199  1.1  lukem 
    200  1.1  lukem 	$CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
    201  1.1  lukem 
    202  1.1  lukem 	if test $? = 0 ; then
    203  1.1  lukem 		break
    204  1.1  lukem 	fi
    205  1.1  lukem 
    206  1.1  lukem 	SLEEP=5
    207  1.1  lukem 	echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
    208  1.1  lukem 	sleep $SLEEP
    209  1.1  lukem done
    210  1.1  lukem 
    211  1.1  lukem #echo "Using ldapsearch to read all the entries from the master..."
    212  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    213  1.1  lukem 	'(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
    214  1.1  lukem RC=$?
    215  1.1  lukem 
    216  1.1  lukem if test $RC != 0 ; then
    217  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    218  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    219  1.1  lukem 	exit $RC
    220  1.1  lukem fi
    221  1.1  lukem 
    222  1.1  lukem #echo "Using ldapsearch to read all the entries from the slave..."
    223  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    224  1.1  lukem 	'(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
    225  1.1  lukem RC=$?
    226  1.1  lukem 
    227  1.1  lukem if test $RC != 0 ; then
    228  1.1  lukem 	echo "ldapsearch failed at slave ($RC)!"
    229  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    230  1.1  lukem 	exit $RC
    231  1.1  lukem fi
    232  1.1  lukem 
    233  1.1  lukem #echo "Filtering master results..."
    234  1.1  lukem . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
    235  1.1  lukem #echo "Filtering slave results..."
    236  1.1  lukem . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
    237  1.1  lukem 
    238  1.1  lukem echo "$CHECK < Comparing retrieved entries from master and slave..."
    239  1.1  lukem $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
    240  1.1  lukem 
    241  1.1  lukem if test $? != 0 ; then
    242  1.1  lukem 	echo "test failed - master and slave databases differ"
    243  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    244  1.1  lukem 	exit 1
    245  1.1  lukem fi
    246  1.1  lukem 
    247  1.1  lukem CHECK=`expr $CHECK + 1`
    248  1.1  lukem SLEEP=10
    249  1.1  lukem echo "$CHECK > Stopping the provider, sleeping $SLEEP seconds and restarting it..."
    250  1.1  lukem kill -HUP "$MASTERPID"
    251  1.1  lukem wait $MASTERPID
    252  1.1  lukem sleep $SLEEP
    253  1.1  lukem 
    254  1.1  lukem echo "======================= RESTART =======================" >> $LOG1
    255  1.1  lukem $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
    256  1.1  lukem MASTERPID=$!
    257  1.1  lukem if test $WAIT != 0 ; then
    258  1.1  lukem     echo MASTERPID $MASTERPID
    259  1.1  lukem     read foo
    260  1.1  lukem fi
    261  1.1  lukem KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
    262  1.1  lukem 
    263  1.1  lukem sleep 1
    264  1.1  lukem 
    265  1.1  lukem echo "Using ldapsearch to check that master slapd is running..."
    266  1.1  lukem for i in 0 1 2 3 4 5; do
    267  1.1  lukem 	$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
    268  1.1  lukem 		'(objectClass=*)' > /dev/null 2>&1
    269  1.1  lukem 	RC=$?
    270  1.1  lukem 	if test $RC = 0 ; then
    271  1.1  lukem 		break
    272  1.1  lukem 	fi
    273  1.1  lukem 	echo "Waiting 5 seconds for slapd to start..."
    274  1.1  lukem 	sleep 5
    275  1.1  lukem done
    276  1.1  lukem 
    277  1.1  lukem if test $RC != 0 ; then
    278  1.1  lukem 	echo "ldapsearch failed ($RC)!"
    279  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    280  1.1  lukem 	exit $RC
    281  1.1  lukem fi
    282  1.1  lukem 
    283  1.1  lukem echo "Using ldapmodify to modify master directory..."
    284  1.1  lukem 
    285  1.1  lukem #
    286  1.1  lukem # Do some modifications
    287  1.1  lukem #
    288  1.1  lukem 
    289  1.1  lukem $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
    290  1.1  lukem 	$TESTOUT 2>&1 << EOMODS
    291  1.1  lukem dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
    292  1.1  lukem changetype: modify
    293  1.1  lukem add: drink
    294  1.1  lukem drink: Orange Juice
    295  1.1  lukem -
    296  1.1  lukem delete: sn
    297  1.1  lukem sn: Jones
    298  1.1  lukem -
    299  1.1  lukem add: sn
    300  1.1  lukem sn: Jones
    301  1.1  lukem 
    302  1.1  lukem dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
    303  1.1  lukem changetype: modify
    304  1.1  lukem replace: drink
    305  1.1  lukem drink: Iced Tea
    306  1.1  lukem 
    307  1.1  lukem dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
    308  1.1  lukem changetype: modify
    309  1.1  lukem delete: uniquemember
    310  1.1  lukem uniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
    311  1.1  lukem uniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
    312  1.1  lukem -
    313  1.1  lukem add: uniquemember
    314  1.1  lukem uniquemember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, dc=example,dc=com
    315  1.1  lukem uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
    316  1.1  lukem 
    317  1.1  lukem dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc
    318  1.1  lukem  =com
    319  1.1  lukem changetype: modify
    320  1.1  lukem delete: cn
    321  1.1  lukem cn: Biiff Jensen
    322  1.1  lukem 
    323  1.1  lukem dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
    324  1.1  lukem changetype: add
    325  1.1  lukem objectclass: OpenLDAPperson
    326  1.1  lukem cn: Gern Jensen
    327  1.1  lukem sn: Jensen
    328  1.1  lukem uid: gjensen
    329  1.1  lukem title: Chief Investigator, ITD
    330  1.1  lukem postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
    331  1.1  lukem seealso: cn=All Staff, ou=Groups, dc=example,dc=com
    332  1.1  lukem drink: Coffee
    333  1.1  lukem homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
    334  1.1  lukem description: Very odd
    335  1.1  lukem facsimiletelephonenumber: +1 313 555 7557
    336  1.1  lukem telephonenumber: +1 313 555 8343
    337  1.1  lukem mail: gjensen@mailgw.example.com
    338  1.1  lukem homephone: +1 313 555 8844
    339  1.1  lukem 
    340  1.1  lukem dn: ou=Retired, ou=People, dc=example,dc=com
    341  1.1  lukem changetype: add
    342  1.1  lukem objectclass: organizationalUnit
    343  1.1  lukem ou: Retired
    344  1.1  lukem 
    345  1.1  lukem dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
    346  1.1  lukem changetype: add
    347  1.1  lukem objectclass: OpenLDAPperson
    348  1.1  lukem cn: Rosco P. Coltrane
    349  1.1  lukem sn: Coltrane
    350  1.1  lukem uid: rosco
    351  1.1  lukem description: Fat tycoon
    352  1.1  lukem 
    353  1.1  lukem dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
    354  1.1  lukem changetype: modrdn
    355  1.1  lukem newrdn: cn=Rosco P. Coltrane
    356  1.1  lukem deleteoldrdn: 1
    357  1.1  lukem newsuperior: ou=Retired, ou=People, dc=example,dc=com
    358  1.1  lukem 
    359  1.1  lukem dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
    360  1.1  lukem changetype: delete
    361  1.1  lukem EOMODS
    362  1.1  lukem 
    363  1.1  lukem RC=$?
    364  1.1  lukem if test $RC != 0 ; then
    365  1.1  lukem 	echo "ldapmodify failed ($RC)!"
    366  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    367  1.1  lukem 	exit $RC
    368  1.1  lukem fi
    369  1.1  lukem 
    370  1.1  lukem # get master contextCSN
    371  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    372  1.1  lukem 	'(objectClass=*)' -s base contextCSN > "${MASTEROUT}.$CHECK" 2>&1
    373  1.1  lukem RC=$?
    374  1.1  lukem if test $RC != 0 ; then
    375  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    376  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    377  1.1  lukem 	exit $RC
    378  1.1  lukem fi
    379  1.1  lukem 
    380  1.1  lukem # check slave contextCSN
    381  1.1  lukem for i in 1 2 3; do
    382  1.1  lukem 	SLEEP=5
    383  1.1  lukem 	echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
    384  1.1  lukem 	sleep $SLEEP
    385  1.1  lukem 
    386  1.1  lukem 	$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    387  1.1  lukem 		'(objectClass=*)' -s base contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
    388  1.1  lukem 	RC=$?
    389  1.1  lukem 
    390  1.1  lukem 	if test $RC != 0 ; then
    391  1.1  lukem 		echo "ldapsearch failed at slave ($RC)!"
    392  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    393  1.1  lukem 		exit $RC
    394  1.1  lukem 	fi
    395  1.1  lukem 
    396  1.1  lukem 	$CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
    397  1.1  lukem 
    398  1.1  lukem 	if test $? = 0 ; then
    399  1.1  lukem 		break
    400  1.1  lukem 	fi
    401  1.1  lukem done
    402  1.1  lukem 
    403  1.1  lukem #echo "Using ldapsearch to read all the entries from the master..."
    404  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    405  1.1  lukem 	'(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
    406  1.1  lukem RC=$?
    407  1.1  lukem 
    408  1.1  lukem if test $RC != 0 ; then
    409  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    410  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    411  1.1  lukem 	exit $RC
    412  1.1  lukem fi
    413  1.1  lukem 
    414  1.1  lukem #echo "Using ldapsearch to read all the entries from the slave..."
    415  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    416  1.1  lukem 	'(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
    417  1.1  lukem RC=$?
    418  1.1  lukem 
    419  1.1  lukem if test $RC != 0 ; then
    420  1.1  lukem 	echo "ldapsearch failed at slave ($RC)!"
    421  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    422  1.1  lukem 	exit $RC
    423  1.1  lukem fi
    424  1.1  lukem 
    425  1.1  lukem #echo "Filtering master results..."
    426  1.1  lukem . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
    427  1.1  lukem #echo "Filtering slave results..."
    428  1.1  lukem . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
    429  1.1  lukem 
    430  1.1  lukem echo "$CHECK < Comparing retrieved entries from master and slave..."
    431  1.1  lukem $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
    432  1.1  lukem 
    433  1.1  lukem if test $? != 0 ; then
    434  1.1  lukem 	echo "test failed - master and slave databases differ"
    435  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    436  1.1  lukem 	exit 1
    437  1.1  lukem fi
    438  1.1  lukem 
    439  1.1  lukem CHECK=`expr $CHECK + 1`
    440  1.1  lukem echo "$CHECK > Stopping proxy to test recovery..."
    441  1.1  lukem kill -HUP $PROXYPID
    442  1.1  lukem wait $PROXYPID
    443  1.1  lukem 
    444  1.1  lukem echo "Modifying more entries on the master..."
    445  1.1  lukem $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
    446  1.1  lukem 	$TESTOUT 2>&1 << EOMODS
    447  1.1  lukem dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
    448  1.1  lukem changetype: modify
    449  1.1  lukem add: description
    450  1.1  lukem description: proxy is down...
    451  1.1  lukem 
    452  1.1  lukem dn: cn=James T. Kirk, ou=Retired, ou=People, dc=example,dc=com
    453  1.1  lukem changetype: add
    454  1.1  lukem objectclass: OpenLDAPperson
    455  1.1  lukem sn: Kirk
    456  1.1  lukem uid: jtk
    457  1.1  lukem cn: James T. Kirk
    458  1.1  lukem 
    459  1.1  lukem dn: cn=Tiberius J. Hooker, ou=Retired, ou=People, dc=example,dc=com
    460  1.1  lukem changetype: add
    461  1.1  lukem objectclass: OpenLDAPperson
    462  1.1  lukem sn: Hooker
    463  1.1  lukem uid: tjh
    464  1.1  lukem cn: Tiberius J. Hooker
    465  1.1  lukem 
    466  1.1  lukem EOMODS
    467  1.1  lukem 
    468  1.1  lukem echo "Restarting proxy..."
    469  1.1  lukem echo "======================= RESTART =======================" >> $LOG3
    470  1.1  lukem $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
    471  1.1  lukem PROXYPID=$!
    472  1.1  lukem if test $WAIT != 0 ; then
    473  1.1  lukem     echo PROXYPID $PROXYPID
    474  1.1  lukem     read foo
    475  1.1  lukem fi
    476  1.1  lukem KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
    477  1.1  lukem 
    478  1.1  lukem # get master contextCSN
    479  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    480  1.1  lukem 	'(objectClass=*)' -s base contextCSN > "${MASTEROUT}.$CHECK" 2>&1
    481  1.1  lukem RC=$?
    482  1.1  lukem if test $RC != 0 ; then
    483  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    484  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    485  1.1  lukem 	exit $RC
    486  1.1  lukem fi
    487  1.1  lukem 
    488  1.1  lukem # check slave contextCSN
    489  1.1  lukem for i in 1 2 3 4 5; do
    490  1.1  lukem 	SLEEP=5
    491  1.1  lukem 	echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
    492  1.1  lukem 	sleep $SLEEP
    493  1.1  lukem 
    494  1.1  lukem 	$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    495  1.1  lukem 		'(objectClass=*)' -s base contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
    496  1.1  lukem 	RC=$?
    497  1.1  lukem 
    498  1.1  lukem 	if test $RC != 0 ; then
    499  1.1  lukem 		echo "ldapsearch failed at slave ($RC)!"
    500  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    501  1.1  lukem 		exit $RC
    502  1.1  lukem 	fi
    503  1.1  lukem 
    504  1.1  lukem 	$CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
    505  1.1  lukem 
    506  1.1  lukem 	if test $? = 0 ; then
    507  1.1  lukem 		break
    508  1.1  lukem 	fi
    509  1.1  lukem done
    510  1.1  lukem 
    511  1.1  lukem #echo "Using ldapsearch to read all the entries from the master..."
    512  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    513  1.1  lukem 	'(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
    514  1.1  lukem RC=$?
    515  1.1  lukem 
    516  1.1  lukem if test $RC != 0 ; then
    517  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    518  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    519  1.1  lukem 	exit $RC
    520  1.1  lukem fi
    521  1.1  lukem 
    522  1.1  lukem #echo "Using ldapsearch to read all the entries from the slave..."
    523  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    524  1.1  lukem 	'(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
    525  1.1  lukem RC=$?
    526  1.1  lukem 
    527  1.1  lukem if test $RC != 0 ; then
    528  1.1  lukem 	echo "ldapsearch failed at slave ($RC)!"
    529  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    530  1.1  lukem 	exit $RC
    531  1.1  lukem fi
    532  1.1  lukem 
    533  1.1  lukem #echo "Filtering master results..."
    534  1.1  lukem . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
    535  1.1  lukem #echo "Filtering slave results..."
    536  1.1  lukem . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
    537  1.1  lukem 
    538  1.1  lukem echo "$CHECK < Comparing retrieved entries from master and slave..."
    539  1.1  lukem $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
    540  1.1  lukem 
    541  1.1  lukem if test $? != 0 ; then
    542  1.1  lukem 	echo "test failed - master and slave databases differ"
    543  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    544  1.1  lukem 	exit 1
    545  1.1  lukem fi
    546  1.1  lukem 
    547  1.1  lukem CHECK=`expr $CHECK + 1`
    548  1.1  lukem echo "$CHECK > Try updating the slave slapd..."
    549  1.1  lukem $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD > \
    550  1.1  lukem 	$TESTOUT 2>&1 << EOMODS
    551  1.1  lukem dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
    552  1.1  lukem changetype: modify
    553  1.1  lukem add: description
    554  1.1  lukem description: This write must fail because directed to a shadow context,
    555  1.1  lukem description: unless the chain overlay is configured appropriately ;)
    556  1.1  lukem 
    557  1.1  lukem EOMODS
    558  1.1  lukem 
    559  1.1  lukem RC=$?
    560  1.1  lukem if test $RC != 0 ; then
    561  1.1  lukem 	echo "ldapmodify failed ($RC)!"
    562  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    563  1.1  lukem 	exit $RC
    564  1.1  lukem fi
    565  1.1  lukem 
    566  1.1  lukem # get master contextCSN
    567  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    568  1.1  lukem 	'(objectClass=*)' -s base contextCSN > "${MASTEROUT}.$CHECK" 2>&1
    569  1.1  lukem RC=$?
    570  1.1  lukem if test $RC != 0 ; then
    571  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    572  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    573  1.1  lukem 	exit $RC
    574  1.1  lukem fi
    575  1.1  lukem 
    576  1.1  lukem # check slave contextCSN
    577  1.1  lukem sleep 1
    578  1.1  lukem 
    579  1.1  lukem for i in 1 2 3; do
    580  1.1  lukem 	$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    581  1.1  lukem 		'(objectClass=*)' -s base contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
    582  1.1  lukem 	RC=$?
    583  1.1  lukem 
    584  1.1  lukem 	if test $RC != 0 ; then
    585  1.1  lukem 		echo "ldapsearch failed at slave ($RC)!"
    586  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    587  1.1  lukem 		exit $RC
    588  1.1  lukem 	fi
    589  1.1  lukem 
    590  1.1  lukem 	$CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
    591  1.1  lukem 
    592  1.1  lukem 	if test $? = 0 ; then
    593  1.1  lukem 		break
    594  1.1  lukem 	fi
    595  1.1  lukem 
    596  1.1  lukem 	SLEEP=5
    597  1.1  lukem 	echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
    598  1.1  lukem 	sleep $SLEEP
    599  1.1  lukem done
    600  1.1  lukem 
    601  1.1  lukem #echo "Using ldapsearch to read all the entries from the master..."
    602  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    603  1.1  lukem 	'(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
    604  1.1  lukem RC=$?
    605  1.1  lukem 
    606  1.1  lukem if test $RC != 0 ; then
    607  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    608  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    609  1.1  lukem 	exit $RC
    610  1.1  lukem fi
    611  1.1  lukem 
    612  1.1  lukem #echo "Using ldapsearch to read all the entries from the slave..."
    613  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    614  1.1  lukem '(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
    615  1.1  lukem RC=$?
    616  1.1  lukem 
    617  1.1  lukem if test $RC != 0 ; then
    618  1.1  lukem 	echo "ldapsearch failed at slave ($RC)!"
    619  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    620  1.1  lukem 	exit $RC
    621  1.1  lukem fi
    622  1.1  lukem 
    623  1.1  lukem #echo "Filtering master results..."
    624  1.1  lukem . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
    625  1.1  lukem #echo "Filtering slave results..."
    626  1.1  lukem . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
    627  1.1  lukem 
    628  1.1  lukem echo "$CHECK < Comparing retrieved entries from master and slave..."
    629  1.1  lukem $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
    630  1.1  lukem 
    631  1.1  lukem if test $? != 0 ; then
    632  1.1  lukem 	echo "test failed - master and slave databases differ"
    633  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    634  1.1  lukem 	exit 1
    635  1.1  lukem fi
    636  1.1  lukem 
    637  1.1  lukem CHECK=`expr $CHECK + 1`
    638  1.1  lukem echo "$CHECK > Stopping consumer to test recovery..."
    639  1.1  lukem kill -HUP $SLAVEPID
    640  1.1  lukem wait $SLAVEPID
    641  1.1  lukem 
    642  1.1  lukem echo "Modifying more entries on the master..."
    643  1.1  lukem $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
    644  1.1  lukem 	$TESTOUT 2>&1 << EOMODS
    645  1.1  lukem dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
    646  1.1  lukem changetype: modify
    647  1.1  lukem add: drink
    648  1.1  lukem drink: Mad Dog 20/20
    649  1.1  lukem 
    650  1.1  lukem EOMODS
    651  1.1  lukem 
    652  1.1  lukem SLEEP=10
    653  1.1  lukem echo "Waiting $SLEEP seconds for syncrepl to retry..."
    654  1.1  lukem sleep $SLEEP
    655  1.1  lukem 
    656  1.1  lukem echo "Restarting consumer..."
    657  1.1  lukem echo "======================= RESTART =======================" >> $LOG2
    658  1.1  lukem $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
    659  1.1  lukem SLAVEPID=$!
    660  1.1  lukem if test $WAIT != 0 ; then
    661  1.1  lukem     echo SLAVEPID $SLAVEPID
    662  1.1  lukem     read foo
    663  1.1  lukem fi
    664  1.1  lukem KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
    665  1.1  lukem 
    666  1.1  lukem # get master contextCSN
    667  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    668  1.1  lukem 	'(objectClass=*)' -s base contextCSN > "${MASTEROUT}.$CHECK" 2>&1
    669  1.1  lukem RC=$?
    670  1.1  lukem if test $RC != 0 ; then
    671  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    672  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    673  1.1  lukem 	exit $RC
    674  1.1  lukem fi
    675  1.1  lukem 
    676  1.1  lukem # check slave contextCSN
    677  1.1  lukem 
    678  1.1  lukem for i in 1 2 3 4 5; do
    679  1.1  lukem 	SLEEP=5
    680  1.1  lukem 	echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
    681  1.1  lukem 	sleep $SLEEP
    682  1.1  lukem 
    683  1.1  lukem 	$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    684  1.1  lukem 		'(objectClass=*)' -s base contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
    685  1.1  lukem 	RC=$?
    686  1.1  lukem 
    687  1.1  lukem 	if test $RC != 0 ; then
    688  1.1  lukem 		echo "ldapsearch failed at slave ($RC)!"
    689  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    690  1.1  lukem 		exit $RC
    691  1.1  lukem 	fi
    692  1.1  lukem 
    693  1.1  lukem 	$CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
    694  1.1  lukem 
    695  1.1  lukem 	if test $? = 0 ; then
    696  1.1  lukem 		break
    697  1.1  lukem 	fi
    698  1.1  lukem done
    699  1.1  lukem 
    700  1.1  lukem #echo "Using ldapsearch to read all the entries from the master..."
    701  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    702  1.1  lukem 	'(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
    703  1.1  lukem RC=$?
    704  1.1  lukem 
    705  1.1  lukem if test $RC != 0 ; then
    706  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    707  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    708  1.1  lukem 	exit $RC
    709  1.1  lukem fi
    710  1.1  lukem 
    711  1.1  lukem #echo "Using ldapsearch to read all the entries from the slave..."
    712  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    713  1.1  lukem 	'(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
    714  1.1  lukem RC=$?
    715  1.1  lukem 
    716  1.1  lukem if test $RC != 0 ; then
    717  1.1  lukem 	echo "ldapsearch failed at slave ($RC)!"
    718  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    719  1.1  lukem 	exit $RC
    720  1.1  lukem fi
    721  1.1  lukem 
    722  1.1  lukem #echo "Filtering master results..."
    723  1.1  lukem . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
    724  1.1  lukem #echo "Filtering slave results..."
    725  1.1  lukem . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
    726  1.1  lukem 
    727  1.1  lukem echo "$CHECK < Comparing retrieved entries from master and slave..."
    728  1.1  lukem $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
    729  1.1  lukem 
    730  1.1  lukem if test $? != 0 ; then
    731  1.1  lukem 	# FIXME: keep the original workaround in place, in case we needed again
    732  1.1  lukem 	if test 1 = 1 ; then
    733  1.1  lukem 		echo "test failed - master and slave databases differ"
    734  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    735  1.1  lukem 		exit 1
    736  1.1  lukem 	fi
    737  1.1  lukem 
    738  1.1  lukem 	echo "	test failed - master and slave databases differ (ignored by now)"
    739  1.1  lukem 	echo "	Stopping proxy to see if it auto-recovers..."
    740  1.1  lukem 	kill -HUP $PROXYPID
    741  1.1  lukem 	wait $PROXYPID
    742  1.1  lukem 
    743  1.1  lukem 	echo "	${CHECK}.1 > Restarting proxy..."
    744  1.1  lukem 	echo "======================= RESTART =======================" >> $LOG3
    745  1.1  lukem 	$SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
    746  1.1  lukem 	PROXYPID=$!
    747  1.1  lukem 	if test $WAIT != 0 ; then
    748  1.1  lukem 		echo PROXYPID $PROXYPID
    749  1.1  lukem 		read foo
    750  1.1  lukem 	fi
    751  1.1  lukem 	KILLPIDS="$MASTERPID $SLAVEPID $PROXYPID"
    752  1.1  lukem 
    753  1.1  lukem 	SLEEP=15
    754  1.1  lukem 	echo "	Waiting $SLEEP seconds for syncrepl to receive changes..."
    755  1.1  lukem 	sleep $SLEEP
    756  1.1  lukem 
    757  1.1  lukem 	#echo "Using ldapsearch to read all the entries from the slave..."
    758  1.1  lukem 	$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    759  1.1  lukem 		'(objectClass=*)' > "${SLAVEOUT}.5.1" 2>&1
    760  1.1  lukem 	RC=$?
    761  1.1  lukem 
    762  1.1  lukem 	if test $RC != 0 ; then
    763  1.1  lukem 		echo "	ldapsearch failed at slave ($RC)!"
    764  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    765  1.1  lukem 		exit $RC
    766  1.1  lukem 	fi
    767  1.1  lukem 
    768  1.1  lukem 	#echo "Filtering slave results..."
    769  1.1  lukem 	. $LDIFFILTER < "${SLAVEOUT}.5.1" > $SLAVEFLT
    770  1.1  lukem 
    771  1.1  lukem 	echo "	${CHECK}.1 < Comparing retrieved entries from master and slave..."
    772  1.1  lukem 	$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
    773  1.1  lukem 
    774  1.1  lukem 	if test $? != 0 ; then
    775  1.1  lukem 		echo "	test failed - master and slave databases differ"
    776  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    777  1.1  lukem 		exit 1
    778  1.1  lukem 	fi
    779  1.1  lukem fi
    780  1.1  lukem 
    781  1.1  lukem #
    782  1.1  lukem # Modifications formerly known to fail
    783  1.1  lukem #
    784  1.1  lukem CHECK=`expr $CHECK + 1`
    785  1.1  lukem echo "$CHECK > Performing modifications that were formerly known to fail..."
    786  1.1  lukem $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
    787  1.1  lukem 	$TESTOUT 2>&1 << EOMODS
    788  1.1  lukem # First, back out previous change
    789  1.1  lukem dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
    790  1.1  lukem changetype: modify
    791  1.1  lukem delete: drink
    792  1.1  lukem drink: Mad Dog 20/20
    793  1.1  lukem 
    794  1.1  lukem # From now on, perform modifications that were formerly known to fail
    795  1.1  lukem dn: cn=All Staff,ou=Groups,dc=example,dc=com
    796  1.1  lukem changetype: modify
    797  1.1  lukem delete: description
    798  1.1  lukem 
    799  1.1  lukem EOMODS
    800  1.1  lukem 
    801  1.1  lukem RC=$?
    802  1.1  lukem if test $RC != 0 ; then
    803  1.1  lukem 	echo "ldapmodify failed ($RC)!"
    804  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    805  1.1  lukem 	exit $RC
    806  1.1  lukem fi
    807  1.1  lukem 
    808  1.1  lukem # get master contextCSN
    809  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    810  1.1  lukem 	'(objectClass=*)' -s base contextCSN > "${MASTEROUT}.$CHECK" 2>&1
    811  1.1  lukem RC=$?
    812  1.1  lukem if test $RC != 0 ; then
    813  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    814  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    815  1.1  lukem 	exit $RC
    816  1.1  lukem fi
    817  1.1  lukem 
    818  1.1  lukem # check slave contextCSN
    819  1.1  lukem sleep 1
    820  1.1  lukem for i in 1 2 3; do
    821  1.1  lukem 	$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    822  1.1  lukem 		'(objectClass=*)' -s base contextCSN > "${SLAVEOUT}.$CHECK" 2>&1
    823  1.1  lukem 	RC=$?
    824  1.1  lukem 
    825  1.1  lukem 	if test $RC != 0 ; then
    826  1.1  lukem 		echo "ldapsearch failed at slave ($RC)!"
    827  1.1  lukem 		test $KILLSERVERS != no && kill -HUP $KILLPIDS
    828  1.1  lukem 		exit $RC
    829  1.1  lukem 	fi
    830  1.1  lukem 
    831  1.1  lukem 	$CMP ${MASTEROUT}.$CHECK ${SLAVEOUT}.$CHECK > $CMPOUT
    832  1.1  lukem 
    833  1.1  lukem 	if test $? = 0 ; then
    834  1.1  lukem 		break
    835  1.1  lukem 	fi
    836  1.1  lukem 
    837  1.1  lukem 	SLEEP=5
    838  1.1  lukem 	echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
    839  1.1  lukem 	sleep $SLEEP
    840  1.1  lukem done
    841  1.1  lukem 
    842  1.1  lukem #echo "Using ldapsearch to read all the entries from the master..."
    843  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
    844  1.1  lukem 	'(objectClass=*)' > "${MASTEROUT}.$CHECK" 2>&1
    845  1.1  lukem RC=$?
    846  1.1  lukem 
    847  1.1  lukem if test $RC != 0 ; then
    848  1.1  lukem 	echo "ldapsearch failed at master ($RC)!"
    849  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    850  1.1  lukem 	exit $RC
    851  1.1  lukem fi
    852  1.1  lukem 
    853  1.1  lukem #echo "Using ldapsearch to read all the entries from the slave..."
    854  1.1  lukem $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
    855  1.1  lukem 	'(objectClass=*)' > "${SLAVEOUT}.$CHECK" 2>&1
    856  1.1  lukem RC=$?
    857  1.1  lukem 
    858  1.1  lukem if test $RC != 0 ; then
    859  1.1  lukem 	echo "ldapsearch failed at slave ($RC)!"
    860  1.1  lukem 	test $KILLSERVERS != no && kill -HUP $KILLPIDS
    861  1.1  lukem 	exit $RC
    862  1.1  lukem fi
    863  1.1  lukem 
    864  1.1  lukem #echo "Filtering master results..."
    865  1.1  lukem . $LDIFFILTER < "${MASTEROUT}.$CHECK" > $MASTERFLT
    866  1.1  lukem #echo "Filtering slave results..."
    867  1.1  lukem . $LDIFFILTER < "${SLAVEOUT}.$CHECK" > $SLAVEFLT
    868  1.1  lukem 
    869  1.1  lukem echo "$CHECK < Comparing retrieved entries from master and slave..."
    870  1.1  lukem $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
    871  1.1  lukem 
    872  1.1  lukem if test $? != 0 ; then
    873  1.1  lukem 	echo "test failed - master and slave databases differ (ignored by now)"
    874  1.1  lukem 	#echo "test failed - master and slave databases differ"
    875  1.1  lukem 	#test $KILLSERVERS != no && kill -HUP $KILLPIDS
    876  1.1  lukem 	#exit 1
    877  1.1  lukem fi
    878  1.1  lukem 
    879  1.1  lukem test $KILLSERVERS != no && kill -HUP $KILLPIDS
    880  1.1  lukem 
    881  1.1  lukem echo ">>>>> Test succeeded"
    882  1.1  lukem 
    883  1.1  lukem test $KILLSERVERS != no && wait
    884  1.1  lukem 
    885  1.1  lukem exit 0
    886