X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tests%2Fscripts%2Ftest050-syncrepl-multimaster;h=57851a3d987a91f4a81ea8e53d01711d09808a4f;hb=dac408369b0812762b3e85f7e024ea472ce79abc;hp=ad508ab93d48918d475277a626ea1c40bdb5b851;hpb=f8c9854aaac0d641a073643b64b0f156af6e3f09;p=openldap
diff --git a/tests/scripts/test050-syncrepl-multimaster b/tests/scripts/test050-syncrepl-multimaster
index ad508ab93d..57851a3d98 100755
--- a/tests/scripts/test050-syncrepl-multimaster
+++ b/tests/scripts/test050-syncrepl-multimaster
@@ -2,7 +2,7 @@
# $OpenLDAP$
## This work is part of OpenLDAP Software .
##
-## Copyright 1998-2009 The OpenLDAP Foundation.
+## Copyright 1998-2011 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
@@ -21,20 +21,16 @@ if test $SYNCPROV = syncprovno; then
exit 0
fi
-PRODIR=$TESTDIR/pro
-CONDIR=$TESTDIR/con1
-CONDIR2=$TESTDIR/con2
-CONDIR3=$TESTDIR/con3
-DBPRO=$PRODIR/db
-DBCON=$CONDIR/db
-DBCON2=$CONDIR2/db
-DBCON3=$CONDIR3/db
-CFPRO=$PRODIR/slapd.d
-CFCON=$CONDIR/slapd.d
-CFCON2=$CONDIR2/slapd.d
-CFCON3=$CONDIR3/slapd.d
-
-mkdir -p $TESTDIR $PRODIR $CONDIR $CONDIR2 $CONDIR3 $DBPRO $DBCON $DBCON2 $DBCON3 $CFPRO $CFCON $CFCON2 $CFCON3
+MMR=${MMR-4}
+
+if [ $MMR -gt 9 ]; then
+MMR=9
+fi
+
+XDIR=$TESTDIR/srv
+TMP=$TESTDIR/tmp
+
+mkdir -p $TESTDIR
$SLAPPASSWD -g -n >$CONFIGPWF
@@ -56,10 +52,7 @@ esac
#
# Test replication of dynamic config:
-# - start producer
-# - start consumer1
-# - start consumer2
-# - start consumer3
+# - start servers
# - configure over ldap
# - populate over ldap
# - configure syncrepl over ldap
@@ -67,35 +60,19 @@ esac
#
echo "Initializing server configurations..."
-$SLAPADD -F $CFCON2 -n 0 < $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
@@ -128,7 +96,7 @@ cd $TESTWD
sleep 1
-echo "Using ldapsearch to check that producer slapd is running..."
+echo "Using ldapsearch to check that server 1 is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "" -H $URI1 \
'objectclass=*' > /dev/null 2>&1
@@ -146,21 +114,18 @@ if test $RC != 0 ; then
exit $RC
fi
-echo "Inserting syncprov overlay on producer..."
+echo "Inserting syncprov overlay on server 1..."
+echo "" > $TMP
if [ "$SYNCPROV" = syncprovmod ]; then
- $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF < $TESTOUT 2>&1
+cat <> $TMP
dn: cn=module,cn=config
+changetype: add
objectClass: olcModuleList
cn: module
-olcModulePath: ../../../servers/slapd/overlays
+olcModulePath: $TESTWD/../servers/slapd/overlays
olcModuleLoad: syncprov.la
+
EOF
- RC=$?
- if test $RC != 0 ; then
- echo "ldapadd failed for moduleLoad ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
- fi
fi
#
# Note that we configure a timeout here; it's possible for both
@@ -170,14 +135,18 @@ fi
# attempt and allow the modifies to complete.
#
read CONFIGPW < $CONFIGPWF
-$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <> $TESTOUT 2>&1
-dn: cn=config
-changetype: modify
-replace: olcServerID
-olcServerID: 1 $URI1
-olcServerID: 2 $URI2
-olcServerID: 3 $URI3
-olcServerID: 4 $URI4
+echo "dn: cn=config" >> $TMP
+echo "changetype: modify" >> $TMP
+echo "replace: olcServerID" >> $TMP
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
+echo "olcServerID: $n $URI" >> $TMP
+n=`expr $n + 1`
+done
+
+cat <> $TMP
dn: olcOverlay=syncprov,olcDatabase={0}config,cn=config
changetype: add
@@ -188,22 +157,21 @@ olcOverlay: syncprov
dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcSyncRepl
-olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=004 provider=$URI4 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
--
-add: olcMirrorMode
-olcMirrorMode: TRUE
EOF
+
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
+echo "olcSyncRepl: rid=00$n provider=$URI binddn=\"cn=config\" bindmethod=simple" >> $TMP
+echo " credentials=$CONFIGPW searchbase=\"cn=config\" type=refreshAndPersist" >> $TMP
+echo " retry=\"3 10 300 5\" timeout=3" >> $TMP
+n=`expr $n + 1`
+done
+echo "-" >> $TMP
+echo "add: olcMirrorMode" >> $TMP
+echo "olcMirrorMode: TRUE" >> $TMP
+$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF < $TMP >> $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed for syncrepl config ($RC)!"
@@ -211,9 +179,14 @@ if test $RC != 0 ; then
exit $RC
fi
-echo "Starting consumer1 slapd on TCP/IP port $PORT2..."
-cd $CONDIR
-$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
+n=2
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
+LOG=$TESTDIR/slapd.$n.log
+echo "Starting server $n on TCP/IP port $PORT..."
+cd ${XDIR}$n
+$SLAPD -F ./slapd.d -h $URI -d $LVL $TIMING > $LOG 2>&1 &
SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVEPID $SLAVEPID
@@ -224,9 +197,9 @@ cd $TESTWD
sleep 1
-echo "Using ldapsearch to check that consumer1 slapd is running..."
+echo "Using ldapsearch to check that server $n is running..."
for i in 0 1 2 3 4 5; do
- $LDAPSEARCH -s base -b "" -H $URI2 \
+ $LDAPSEARCH -s base -b "" -H $URI \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
@@ -242,135 +215,31 @@ if test $RC != 0 ; then
exit $RC
fi
-echo "Configuring syncrepl on consumer1..."
-$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <>$TESTOUT 2>&1
+echo "Configuring syncrepl on server $n..."
+cat < $TMP
dn: olcDatabase={0}config,cn=config
changetype: modify
add: olcSyncRepl
-olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=004 provider=$URI4 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
--
-add: olcMirrorMode
-olcMirrorMode: TRUE
EOF
-
-echo "Starting consumer2 slapd on TCP/IP port $PORT3..."
-cd $CONDIR2
-$SLAPD -F ./slapd.d -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
-SLAVE2PID=$!
-if test $WAIT != 0 ; then
- echo SLAVE2PID $SLAVE2PID
- read foo
-fi
-KILLPIDS="$KILLPIDS $SLAVE2PID"
-cd $TESTWD
-
-sleep 1
-
-echo "Using ldapsearch to check that consumer2 slapd is running..."
-for i in 0 1 2 3 4 5; do
- $LDAPSEARCH -s base -b "" -H $URI3 \
- 'objectclass=*' > /dev/null 2>&1
- RC=$?
- if test $RC = 0 ; then
- break
- fi
- echo "Waiting 5 seconds for slapd to start..."
- sleep 5
+j=1
+while [ $j -le $MMR ]; do
+P2=`expr $BASEPORT + $j`
+U2="ldap://${LOCALHOST}:$P2/"
+echo "olcSyncRepl: rid=00$j provider=$U2 binddn=\"cn=config\" bindmethod=simple" >> $TMP
+echo " credentials=$CONFIGPW searchbase=\"cn=config\" type=refreshAndPersist" >> $TMP
+echo " retry=\"3 10 300 5\" timeout=3" >> $TMP
+j=`expr $j + 1`
done
-
-if test $RC != 0 ; then
- echo "ldapsearch failed ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Configuring syncrepl on consumer2..."
-$LDAPMODIFY -D cn=config -H $URI3 -y $CONFIGPWF <>$TESTOUT 2>&1
-dn: olcDatabase={0}config,cn=config
-changetype: modify
-add: olcSyncRepl
-olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=004 provider=$URI4 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
+cat <> $TMP
-
add: olcMirrorMode
olcMirrorMode: TRUE
EOF
-
-echo "Starting consumer3 slapd on TCP/IP port $PORT4..."
-cd $CONDIR3
-$SLAPD -F ./slapd.d -h $URI4 -d $LVL $TIMING > $LOG4 2>&1 &
-SLAVE3PID=$!
-if test $WAIT != 0 ; then
- echo SLAVE3PID $SLAVE3PID
- read foo
-fi
-KILLPIDS="$KILLPIDS $SLAVE3PID"
-cd $TESTWD
-
-sleep 1
-
-echo "Using ldapsearch to check that consumer3 slapd is running..."
-for i in 0 1 2 3 4 5; do
- $LDAPSEARCH -s base -b "" -H $URI4 \
- 'objectclass=*' > /dev/null 2>&1
- RC=$?
- if test $RC = 0 ; then
- break
- fi
- echo "Waiting 5 seconds for slapd to start..."
- sleep 5
+$LDAPMODIFY -D cn=config -H $URI -y $CONFIGPWF < $TMP >>$TESTOUT 2>&1
+n=`expr $n + 1`
done
-if test $RC != 0 ; then
- echo "ldapsearch failed ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Configuring syncrepl on consumer3..."
-$LDAPMODIFY -D cn=config -H $URI4 -y $CONFIGPWF <>$TESTOUT 2>&1
-dn: olcDatabase={0}config,cn=config
-changetype: modify
-add: olcSyncRepl
-olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=004 provider=$URI4 binddn="cn=config" bindmethod=simple
- credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
- retry="3 5 300 5" timeout=3
--
-add: olcMirrorMode
-olcMirrorMode: TRUE
-EOF
-
-echo "Adding schema and databases on producer..."
+echo "Adding schema and databases on server 1..."
$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <>$TESTOUT 2>&1
include: file://$ABS_SCHEMADIR/core.ldif
@@ -389,51 +258,52 @@ if test $RC != 0 ; then
exit $RC
fi
+nullExclude=""
+test $BACKEND = null && nullExclude="# "
+
+echo "" > $TMP
if [ "$BACKENDTYPE" = mod ]; then
- $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <>$TESTOUT 2>&1
+cat <> $TMP
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
-olcModulePath: ../../../servers/slapd/back-$BACKEND
+olcModulePath: $TESTWD/../servers/slapd/back-$BACKEND
olcModuleLoad: back_$BACKEND.la
+
EOF
- RC=$?
- if test $RC != 0 ; then
- echo "ldapadd failed for backend config ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
- fi
fi
-$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <>$TESTOUT 2>&1
+cat <> $TMP
dn: olcDatabase={1}$BACKEND,cn=config
objectClass: olcDatabaseConfig
-objectClass: olc${BACKEND}Config
+${nullExclude}objectClass: olc${BACKEND}Config
olcDatabase: {1}$BACKEND
olcSuffix: $BASEDN
-olcDbDirectory: ./db
+${nullExclude}olcDbDirectory: ./db
olcRootDN: $MANAGERDN
olcRootPW: $PASSWD
-olcSyncRepl: rid=005 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
- credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=006 provider=$URI2 binddn="$MANAGERDN" bindmethod=simple
- credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=007 provider=$URI3 binddn="$MANAGERDN" bindmethod=simple
- credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
- retry="3 5 300 5" timeout=3
-olcSyncRepl: rid=008 provider=$URI4 binddn="$MANAGERDN" bindmethod=simple
- credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
- retry="3 5 300 5" timeout=3
+EOF
+
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
+
+echo "olcSyncRepl: rid=01$n provider=$URI binddn=\"$MANAGERDN\" bindmethod=simple" >> $TMP
+echo " credentials=$PASSWD searchbase=\"$BASEDN\" $SYNCTYPE" >> $TMP
+echo " retry=\"3 10 300 5\" timeout=3" >> $TMP
+n=`expr $n + 1`
+done
+
+cat <> $TMP
olcMirrorMode: TRUE
dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
-changetype: add
objectClass: olcOverlayConfig
objectClass: olcSyncProvConfig
olcOverlay: syncprov
EOF
+$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF < $TMP >>$TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed for database config ($RC)!"
@@ -441,8 +311,7 @@ if test $RC != 0 ; then
exit $RC
fi
-case $BACKEND in
-bdb | hdb)
+if test $INDEXDB = indexdb ; then
$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <>$TESTOUT 2>&1
dn: olcDatabase={1}$BACKEND,cn=config
changetype: modify
@@ -456,185 +325,93 @@ EOF
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
- ;;
-esac
+fi
-echo "Using ldapadd to populate producer..."
+echo "Using ldapadd to populate server 1..."
$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \
>> $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapadd failed for producer database ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
-sleep $SLEEP1
-
-echo "Using ldapsearch to read config from the producer..."
-$LDAPSEARCH -b cn=config -D cn=config -H $URI1 -y $CONFIGPWF \
- 'objectclass=*' > $MASTEROUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at producer ($RC)!"
+ echo "ldapadd failed for server 1 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-echo "Using ldapsearch to read config from consumer1..."
-$LDAPSEARCH -b cn=config -D cn=config -H $URI2 -y $CONFIGPWF \
- 'objectclass=*' > $SLAVEOUT 2>&1
-RC=$?
+echo "Waiting $SLEEP2 seconds for syncrepl to receive changes..."
+sleep $SLEEP2
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer1 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
-echo "Using ldapsearch to read config from consumer2..."
-$LDAPSEARCH -b cn=config -D cn=config -H $URI3 -y $CONFIGPWF \
- 'objectclass=*' > $SLAVE2OUT 2>&1
+echo "Using ldapsearch to read config from server $n..."
+$LDAPSEARCH -b cn=config -D cn=config -H $URI -y $CONFIGPWF \
+ 'objectclass=*' > $TESTDIR/server$n.out 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed at consumer2 ($RC)!"
+ echo "ldapsearch failed at server $n ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-echo "Using ldapsearch to read config from consumer3..."
-$LDAPSEARCH -b cn=config -D cn=config -H $URI4 -y $CONFIGPWF \
- 'objectclass=*' > $SERVER4OUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer3 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Filtering producer results..."
-. $LDIFFILTER < $MASTEROUT > $MASTERFLT
-echo "Filtering consumer1 results..."
-. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
-echo "Filtering consumer2 results..."
-. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
-echo "Filtering consumer3 results..."
-. $LDIFFILTER < $SERVER4OUT > $SERVER4FLT
-
-echo "Comparing retrieved configs from producer and consumer1..."
-$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer1 configs differ"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit 1
-fi
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
-echo "Comparing retrieved configs from producer and consumer2..."
-$CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer2 configs differ"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit 1
-fi
+n=`expr $n + 1`
+done
-echo "Comparing retrieved configs from producer and consumer3..."
-$CMP $MASTERFLT $SERVER4FLT > $CMPOUT
+n=2
+while [ $n -le $MMR ]; do
+echo "Comparing retrieved configs from server 1 and server $n..."
+$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
if test $? != 0 ; then
- echo "test failed - producer and consumer3 configs differ"
+ echo "test failed - server 1 and server $n configs differ"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
+n=`expr $n + 1`
+done
-echo "Using ldapsearch to read all the entries from the producer..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD \
- 'objectclass=*' > $MASTEROUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at producer ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Using ldapsearch to read all the entries from consumer1..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \
- 'objectclass=*' > $SLAVEOUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer1 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
-echo "Using ldapsearch to read all the entries from consumer2..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD \
- 'objectclass=*' > $SLAVE2OUT 2>&1
+echo "Using ldapsearch to read all the entries from server $n..."
+$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
+ 'objectclass=*' > $TESTDIR/server$n.out 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed at consumer2 ($RC)!"
+ echo "ldapsearch failed at server $n ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+n=`expr $n + 1`
+done
-echo "Using ldapsearch to read all the entries from consumer3..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI4 -w $PASSWD \
- 'objectclass=*' > $SERVER4OUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer3 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Filtering producer results..."
-. $LDIFFILTER < $MASTEROUT > $MASTERFLT
-echo "Filtering consumer1 results..."
-. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
-echo "Filtering consumer2 results..."
-. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
-echo "Filtering consumer3 results..."
-. $LDIFFILTER < $SERVER4OUT > $SERVER4FLT
-
-echo "Comparing retrieved entries from producer and consumer1..."
-$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer1 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer2..."
-$CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer2 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer3..."
-$CMP $MASTERFLT $SERVER4FLT > $CMPOUT
+n=2
+while [ $n -le $MMR ]; do
+echo "Comparing retrieved entries from server 1 and server $n..."
+$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
if test $? != 0 ; then
- echo "test failed - producer and consumer3 databases differ"
+ echo "test failed - server 1 and server $n databases differ"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
+n=`expr $n + 1`
+done
-echo "Using ldapadd to populate consumer1..."
+echo "Using ldapadd to populate server 2..."
$LDAPADD -D "$MANAGERDN" -H $URI2 -w $PASSWD -f $LDIFADD1 \
>> $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapadd failed for consumer1 database ($RC)!"
+ echo "ldapadd failed for server 2 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
@@ -642,94 +419,49 @@ fi
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
sleep $SLEEP1
-echo "Using ldapsearch to read all the entries from the producer..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD \
- 'objectclass=*' > $MASTEROUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at producer ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
-echo "Using ldapsearch to read all the entries from consumer1..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \
- 'objectclass=*' > $SLAVEOUT 2>&1
+echo "Using ldapsearch to read all the entries from server $n..."
+$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
+ 'objectclass=*' > $TESTDIR/server$n.out 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed at consumer1 ($RC)!"
+ echo "ldapsearch failed at server $n ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+n=`expr $n + 1`
+done
-echo "Using ldapsearch to read all the entries from consumer2..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD \
- 'objectclass=*' > $SLAVE2OUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer2 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Using ldapsearch to read all the entries from consumer3..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI4 -w $PASSWD \
- 'objectclass=*' > $SERVER4OUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer3 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Filtering producer results..."
-. $LDIFFILTER < $MASTEROUT > $MASTERFLT
-echo "Filtering consumer1 results..."
-. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
-echo "Filtering consumer2 results..."
-. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
-echo "Filtering consumer3 results..."
-. $LDIFFILTER < $SERVER4OUT > $SERVER4FLT
-
-echo "Comparing retrieved entries from producer and consumer1..."
-$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer1 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer2..."
-$CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer2 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer3..."
-$CMP $MASTERFLT $SERVER4FLT > $CMPOUT
+n=2
+while [ $n -le $MMR ]; do
+echo "Comparing retrieved entries from server 1 and server $n..."
+$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
if test $? != 0 ; then
- echo "test failed - producer and consumer3 databases differ"
+ echo "test failed - server 1 and server $n databases differ"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
+n=`expr $n + 1`
+done
-echo "Using ldapadd to populate consumer2..."
+echo "Using ldapadd to populate server 3..."
$LDAPADD -D "$MANAGERDN" -H $URI3 -w $PASSWD \
<< EOMODS >> $TESTOUT 2>&1
-dn: cn=Consumer 2 Test,dc=example,dc=com
+dn: cn=Server 3 Test,dc=example,dc=com
changetype: add
objectClass: device
-cn: Consumer 2 Test
+cn: Server 3 Test
EOMODS
RC=$?
if test $RC != 0 ; then
- echo "ldapadd failed for consumer2 database ($RC)!"
+ echo "ldapadd failed for server 3 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
@@ -737,107 +469,62 @@ fi
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
sleep $SLEEP1
-echo "Using ldapsearch to read all the entries from the producer..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD \
- 'objectclass=*' > $MASTEROUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at producer ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
-echo "Using ldapsearch to read all the entries from consumer1..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \
- 'objectclass=*' > $SLAVEOUT 2>&1
+echo "Using ldapsearch to read all the entries from server $n..."
+$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
+ 'objectclass=*' > $TESTDIR/server$n.out 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed at consumer1 ($RC)!"
+ echo "ldapsearch failed at server $n ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+n=`expr $n + 1`
+done
-echo "Using ldapsearch to read all the entries from consumer2..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD \
- 'objectclass=*' > $SLAVE2OUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer2 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Using ldapsearch to read all the entries from consumer3..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI4 -w $PASSWD \
- 'objectclass=*' > $SERVER4OUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer3 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Filtering producer results..."
-. $LDIFFILTER < $MASTEROUT > $MASTERFLT
-echo "Filtering consumer1 results..."
-. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
-echo "Filtering consumer2 results..."
-. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
-echo "Filtering consumer3 results..."
-. $LDIFFILTER < $SERVER4OUT > $SERVER4FLT
-
-echo "Comparing retrieved entries from producer and consumer1..."
-$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer1 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer2..."
-$CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer2 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer3..."
-$CMP $MASTERFLT $SERVER4FLT > $CMPOUT
+n=2
+while [ $n -le $MMR ]; do
+echo "Comparing retrieved entries from server 1 and server $n..."
+$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
if test $? != 0 ; then
- echo "test failed - producer and consumer3 databases differ"
+ echo "test failed - server 1 and server $n databases differ"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
+n=`expr $n + 1`
+done
-echo "Using ldapmodify to add to the producer entries that will be deleted..."
+echo "Using ldapmodify to add to server 1 entries that will be deleted..."
$LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
>> $TESTOUT 2>&1 << EOADDS
-dn: cn=To be deleted by producer,dc=example,dc=com
+dn: cn=To be deleted by server 1,dc=example,dc=com
changetype: add
objectClass: device
# no distinguished values, will be added by DSA
-dn: cn=To be deleted by consumer1,dc=example,dc=com
+dn: cn=To be deleted by server 2,dc=example,dc=com
changetype: add
objectClass: device
# no distinguished values, will be added by DSA
-dn: cn=To be deleted by consumer2,dc=example,dc=com
+dn: cn=To be deleted by server 3,dc=example,dc=com
changetype: add
objectClass: device
# no distinguished values, will be added by DSA
-dn: cn=To be deleted by producer,dc=example,dc=com
+dn: cn=To be deleted by server 1,dc=example,dc=com
changetype: delete
EOADDS
RC=$?
if test $RC != 0 ; then
- echo "ldapmodify failed for producer database ($RC)!"
+ echo "ldapmodify failed for server 1 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
@@ -845,92 +532,47 @@ fi
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
sleep $SLEEP1
-echo "Using ldapsearch to read all the entries from the producer..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD \
- 'objectclass=*' > $MASTEROUT 2>&1
-RC=$?
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
-if test $RC != 0 ; then
- echo "ldapsearch failed at producer ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Using ldapsearch to read all the entries from consumer1..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \
- 'objectclass=*' > $SLAVEOUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer1 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Using ldapsearch to read all the entries from consumer2..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD \
- 'objectclass=*' > $SLAVE2OUT 2>&1
+echo "Using ldapsearch to read all the entries from server $n..."
+$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
+ 'objectclass=*' > $TESTDIR/server$n.out 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed at consumer2 ($RC)!"
+ echo "ldapsearch failed at server $n ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+n=`expr $n + 1`
+done
-echo "Using ldapsearch to read all the entries from consumer3..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI4 -w $PASSWD \
- 'objectclass=*' > $SERVER4OUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer3 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Filtering producer results..."
-. $LDIFFILTER < $MASTEROUT > $MASTERFLT
-echo "Filtering consumer1 results..."
-. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
-echo "Filtering consumer2 results..."
-. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
-echo "Filtering consumer3 results..."
-. $LDIFFILTER < $SERVER4OUT > $SERVER4FLT
-
-echo "Comparing retrieved entries from producer and consumer1..."
-$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer1 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer2..."
-$CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer2 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer3..."
-$CMP $MASTERFLT $SERVER4FLT > $CMPOUT
+n=2
+while [ $n -le $MMR ]; do
+echo "Comparing retrieved entries from server 1 and server $n..."
+$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
if test $? != 0 ; then
- echo "test failed - producer and consumer3 databases differ"
+ echo "test failed - server 1 and server $n databases differ"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
+n=`expr $n + 1`
+done
-echo "Using ldapmodify to delete entries from consumer1..."
+echo "Using ldapmodify to delete entries from server 2..."
$LDAPMODIFY -D "$MANAGERDN" -H $URI2 -w $PASSWD \
>> $TESTOUT 2>&1 << EOADDS
-dn: cn=To be deleted by consumer1,dc=example,dc=com
+dn: cn=To be deleted by server 2,dc=example,dc=com
changetype: delete
EOADDS
RC=$?
if test $RC != 0 ; then
- echo "ldapmodify failed for consumer1 database ($RC)!"
+ echo "ldapmodify failed for server 2 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
@@ -938,15 +580,15 @@ fi
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
sleep $SLEEP1
-echo "Using ldapmodify to delete entries from consumer2..."
+echo "Using ldapmodify to delete entries from server 3..."
$LDAPMODIFY -D "$MANAGERDN" -H $URI3 -w $PASSWD \
>> $TESTOUT 2>&1 << EOADDS
-dn: cn=To be deleted by consumer2,dc=example,dc=com
+dn: cn=To be deleted by server 3,dc=example,dc=com
changetype: delete
EOADDS
RC=$?
if test $RC != 0 ; then
- echo "ldapmodify failed for consumer2 database ($RC)!"
+ echo "ldapmodify failed for server 3 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
@@ -954,96 +596,53 @@ fi
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
sleep $SLEEP1
-echo "Using ldapsearch to read all the entries from the producer..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD \
- 'objectclass=*' > $MASTEROUT 2>&1
-RC=$?
-
-if test $RC != 0 ; then
- echo "ldapsearch failed at producer ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Using ldapsearch to read all the entries from consumer1..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \
- 'objectclass=*' > $SLAVEOUT 2>&1
-RC=$?
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer1 ($RC)!"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
-fi
-
-echo "Using ldapsearch to read all the entries from consumer2..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD \
- 'objectclass=*' > $SLAVE2OUT 2>&1
+echo "Using ldapsearch to read all the entries from server $n..."
+$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
+ 'objectclass=*' > $TESTDIR/server$n.out 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed at consumer2 ($RC)!"
+ echo "ldapsearch failed at server $n ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+n=`expr $n + 1`
+done
-echo "Using ldapsearch to read all the entries from consumer3..."
-$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI4 -w $PASSWD \
- 'objectclass=*' > $SERVER4OUT 2>&1
-RC=$?
+n=2
+while [ $n -le $MMR ]; do
+echo "Comparing retrieved entries from server 1 and server $n..."
+$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
-if test $RC != 0 ; then
- echo "ldapsearch failed at consumer3 ($RC)!"
+if test $? != 0 ; then
+ echo "test failed - server 1 and server $n databases differ"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit $RC
+ exit 1
fi
+n=`expr $n + 1`
+done
# kill!
# test $KILLSERVERS != no && kill -HUP $KILLPIDS
kill -HUP $KILLPIDS
-echo "Filtering producer results..."
-. $LDIFFILTER < $MASTEROUT > $MASTERFLT
-echo "Filtering consumer1 results..."
-. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
-echo "Filtering consumer2 results..."
-. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
-echo "Filtering consumer3 results..."
-. $LDIFFILTER < $SERVER4OUT > $SERVER4FLT
-
-echo "Comparing retrieved entries from producer and consumer1..."
-$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer1 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer2..."
-$CMP $MASTERFLT $SLAVE2FLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer2 databases differ"
- exit 1
-fi
-
-echo "Comparing retrieved entries from producer and consumer3..."
-$CMP $MASTERFLT $SERVER4FLT > $CMPOUT
-
-if test $? != 0 ; then
- echo "test failed - producer and consumer3 databases differ"
- exit 1
-fi
-
# kill!
# test $KILLSERVERS != no && wait
wait
echo "Restarting servers..."
-echo "Starting producer slapd on TCP/IP port $PORT1..."
-cd $PRODIR
+KILLPIDS=""
+
+echo "Starting server 1 on TCP/IP port $PORT1..."
echo "======================= RESTART =======================" >> $LOG1
-$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
+cd ${XDIR}1
+$SLAPD -F slapd.d -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
@@ -1051,7 +650,10 @@ if test $WAIT != 0 ; then
fi
KILLPIDS="$PID"
cd $TESTWD
-echo "Using ldapsearch to check that producer slapd is running..."
+
+sleep 1
+
+echo "Using ldapsearch to check that server 1 is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "" -H $URI1 \
'objectclass=*' > /dev/null 2>&1
@@ -1068,24 +670,33 @@ if test $RC != 0 ; then
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-#exit 0
-echo "Starting consumer1 slapd on TCP/IP port $PORT2..."
-cd $CONDIR
-echo "======================= RESTART =======================" >> $LOG2
-$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
-SLAVEPID=$!
+
+n=2
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
+LOG=$TESTDIR/slapd.$n.log
+echo "Starting server $n on TCP/IP port $PORT..."
+cd ${XDIR}$n
+echo "======================= RESTART =======================" >> $LOG
+$SLAPD -F ./slapd.d -h $URI -d $LVL $TIMING >> $LOG 2>&1 &
+PID=$!
if test $WAIT != 0 ; then
- echo SLAVEPID $SLAVEPID
+ echo PID $PID
read foo
fi
-KILLPIDS="$KILLPIDS $SLAVEPID"
+KILLPIDS="$KILLPIDS $PID"
cd $TESTWD
+n=`expr $n + 1`
+done
-sleep 1
-
-echo "Using ldapsearch to check that consumer1 slapd is running..."
+n=2
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
+echo "Using ldapsearch to check that server $n is running..."
for i in 0 1 2 3 4 5; do
- $LDAPSEARCH -s base -b "" -H $URI2 \
+ $LDAPSEARCH -s base -b "" -H $URI \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
@@ -1100,74 +711,74 @@ if test $RC != 0 ; then
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
+n=`expr $n + 1`
+done
-echo "Starting consumer2 slapd on TCP/IP port $PORT3..."
-cd $CONDIR2
-echo "======================= RESTART =======================" >> $LOG3
-$SLAPD -F ./slapd.d -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
-SLAVE2PID=$!
-if test $WAIT != 0 ; then
- echo SLAVE2PID $SLAVE2PID
- read foo
-fi
-KILLPIDS="$KILLPIDS $SLAVE2PID"
-cd $TESTWD
+# Insert modifications and more tests here.
+echo "Waiting $SLEEP1 seconds for servers to resync..."
+sleep $SLEEP1
-sleep 1
+echo "Using ldapmodify to add/modify/delete entries from server 1..."
+for i in 1 2 3 4 5 6 7 8 9 10; do
+echo " iteration $i"
+$LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
+ >> $TESTOUT 2>&1 << EOMODS
+dn: cn=Add-Mod-Del,dc=example,dc=com
+changetype: add
+cn: Add-Mod-Del
+objectclass: organizationalRole
-echo "Using ldapsearch to check that consumer2 slapd is running..."
-for i in 0 1 2 3 4 5; do
- $LDAPSEARCH -s base -b "" -H $URI3 \
- 'objectclass=*' > /dev/null 2>&1
- RC=$?
- if test $RC = 0 ; then
- break
- fi
- echo "Waiting 5 seconds for slapd to start..."
- sleep 5
-done
+dn: cn=Add-Mod-Del,dc=example,dc=com
+changetype: modify
+replace: description
+description: guinea pig
+-
+dn: cn=Add-Mod-Del,dc=example,dc=com
+changetype: delete
+EOMODS
+RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed ($RC)!"
+ echo "ldapmodify failed for server 1 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
+done
-echo "Starting consumer3 slapd on TCP/IP port $PORT4..."
-cd $CONDIR3
-echo "======================= RESTART =======================" >> $LOG4
-$SLAPD -F ./slapd.d -h $URI4 -d $LVL $TIMING >> $LOG4 2>&1 &
-SLAVE3PID=$!
-if test $WAIT != 0 ; then
- echo SLAVE3PID $SLAVE3PID
- read foo
-fi
-KILLPIDS="$KILLPIDS $SLAVE3PID"
-cd $TESTWD
+echo "Waiting $SLEEP1 seconds for servers to resync..."
+sleep $SLEEP1
-sleep 1
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
-echo "Using ldapsearch to check that consumer3 slapd is running..."
-for i in 0 1 2 3 4 5; do
- $LDAPSEARCH -s base -b "" -H $URI4 \
- 'objectclass=*' > /dev/null 2>&1
- RC=$?
- if test $RC = 0 ; then
- break
- fi
- echo "Waiting 5 seconds for slapd to start..."
- sleep 5
-done
+echo "Using ldapsearch to read all the entries from server $n..."
+$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
+ 'objectclass=*' > $TESTDIR/server$n.out 2>&1
+RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed ($RC)!"
+ echo "ldapsearch failed at server $n ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+n=`expr $n + 1`
+done
-# Insert modifications and more tests here.
-echo "Waiting $SLEEP1 seconds for servers to resync..."
-sleep $SLEEP1
+n=2
+while [ $n -le $MMR ]; do
+echo "Comparing retrieved entries from server 1 and server $n..."
+$CMP $MASTERFLT $TESTDIR/server$n.flt > $CMPOUT
+
+if test $? != 0 ; then
+ echo "test failed - server 1 and server $n databases differ"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit 1
+fi
+n=`expr $n + 1`
+done
test $KILLSERVERS != no && kill -HUP $KILLPIDS