X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tests%2Fscripts%2Ftest050-syncrepl-multimaster;h=57851a3d987a91f4a81ea8e53d01711d09808a4f;hb=dac408369b0812762b3e85f7e024ea472ce79abc;hp=84cc576b94ab1f25ef688f3f3b3ff45e996fe42a;hpb=6ee9c8838f9874283d6e52e608e898dc47585443;p=openldap
diff --git a/tests/scripts/test050-syncrepl-multimaster b/tests/scripts/test050-syncrepl-multimaster
index 84cc576b94..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
@@ -122,7 +122,7 @@ dn: cn=module,cn=config
changetype: add
objectClass: olcModuleList
cn: module
-olcModulePath: ../../../servers/slapd/overlays
+olcModulePath: $TESTWD/../servers/slapd/overlays
olcModuleLoad: syncprov.la
EOF
@@ -165,7 +165,7 @@ 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 5 300 5\" timeout=3" >> $TMP
+echo " retry=\"3 10 300 5\" timeout=3" >> $TMP
n=`expr $n + 1`
done
echo "-" >> $TMP
@@ -227,7 +227,7 @@ 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 5 300 5\" timeout=3" >> $TMP
+echo " retry=\"3 10 300 5\" timeout=3" >> $TMP
j=`expr $j + 1`
done
cat <> $TMP
@@ -258,13 +258,16 @@ if test $RC != 0 ; then
exit $RC
fi
+nullExclude=""
+test $BACKEND = null && nullExclude="# "
+
echo "" > $TMP
if [ "$BACKENDTYPE" = mod ]; then
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
@@ -273,10 +276,10 @@ fi
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
EOF
@@ -288,7 +291,7 @@ 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 5 300 5\" timeout=3" >> $TMP
+echo " retry=\"3 10 300 5\" timeout=3" >> $TMP
n=`expr $n + 1`
done
@@ -308,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
@@ -323,8 +325,7 @@ EOF
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
- ;;
-esac
+fi
echo "Using ldapadd to populate server 1..."
$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \
@@ -336,8 +337,8 @@ if test $RC != 0 ; then
exit $RC
fi
-echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
-sleep $SLEEP1
+echo "Waiting $SLEEP2 seconds for syncrepl to receive changes..."
+sleep $SLEEP2
n=1
while [ $n -le $MMR ]; do
@@ -355,7 +356,7 @@ if test $RC != 0 ; then
exit $RC
fi
-. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
n=`expr $n + 1`
done
@@ -388,7 +389,7 @@ if test $RC != 0 ; then
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
n=`expr $n + 1`
done
@@ -433,7 +434,7 @@ if test $RC != 0 ; then
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
n=`expr $n + 1`
done
@@ -483,7 +484,7 @@ if test $RC != 0 ; then
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
n=`expr $n + 1`
done
@@ -546,7 +547,7 @@ if test $RC != 0 ; then
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
n=`expr $n + 1`
done
@@ -610,7 +611,7 @@ if test $RC != 0 ; then
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-. $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
+$LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
n=`expr $n + 1`
done
@@ -637,7 +638,40 @@ wait
echo "Restarting servers..."
KILLPIDS=""
-n=1
+
+echo "Starting server 1 on TCP/IP port $PORT1..."
+echo "======================= RESTART =======================" >> $LOG1
+cd ${XDIR}1
+$SLAPD -F slapd.d -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
+PID=$!
+if test $WAIT != 0 ; then
+ echo PID $PID
+ read foo
+fi
+KILLPIDS="$PID"
+cd $TESTWD
+
+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
+ RC=$?
+ if test $RC = 0 ; then
+ break
+ fi
+ echo "Waiting 5 seconds for slapd to start..."
+ sleep 5
+done
+
+if test $RC != 0 ; then
+ echo "ldapsearch failed ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+n=2
while [ $n -le $MMR ]; do
PORT=`expr $BASEPORT + $n`
URI="ldap://${LOCALHOST}:$PORT/"
@@ -653,6 +687,13 @@ if test $WAIT != 0 ; then
fi
KILLPIDS="$KILLPIDS $PID"
cd $TESTWD
+n=`expr $n + 1`
+done
+
+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 $URI \
@@ -677,6 +718,68 @@ done
echo "Waiting $SLEEP1 seconds for servers to resync..."
sleep $SLEEP1
+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
+
+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 "ldapmodify failed for server 1 database ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+done
+
+echo "Waiting $SLEEP1 seconds for servers to resync..."
+sleep $SLEEP1
+
+n=1
+while [ $n -le $MMR ]; do
+PORT=`expr $BASEPORT + $n`
+URI="ldap://${LOCALHOST}:$PORT/"
+
+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 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
+
+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
echo ">>>>> Test succeeded"