Cascading replication test script

This commit is contained in:
Jong Hyuk Choi 2003-06-26 06:12:55 +00:00
parent 9df9b1377a
commit 73f17befb7
10 changed files with 627 additions and 41 deletions

View File

@ -25,7 +25,7 @@ test-bdb: FORCE
@-$(LN_S) ../libraries/liblunicode ucdata
@if test "$(BUILD_BDB)" != "no"; then \
echo "Initiating LDAP tests for BDB..." ; \
$(MKDIR) test-db test-repl || true; \
$(MKDIR) test-db test-repl test-repl/r1 test-repl/r2 test-repl/p1 test-repl/p2 test-repl/p3 || true; \
$(srcdir)/scripts/all $(srcdir) bdb $(BUILD_BDB) $(BUILD_MONITOR) ; \
else \
echo "run configure with --enable-bdb" ; \
@ -38,7 +38,7 @@ test-hdb: FORCE
@-$(LN_S) ../libraries/liblunicode ucdata
@if test "$(BUILD_HDB)" != "no" ; then \
echo "Initiating LDAP tests for HDB..." ; \
$(MKDIR) test-db test-repl || true; \
$(MKDIR) test-db test-repl test-repl/r1 test-repl/r2 test-repl/p1 test-repl/p2 test-repl/p3 || true; \
$(srcdir)/scripts/all $(srcdir) hdb $(BUILD_HDB) $(BUILD_MONITOR) ; \
else \
echo "run configure with --enable-hdb" ; \
@ -51,7 +51,7 @@ test-ldbm: FORCE
@-$(LN_S) ../libraries/liblunicode ucdata
@if test "$(BUILD_LDBM)" != "no"; then \
echo "Initiating LDAP tests for LDBM..." ; \
$(MKDIR) test-db test-repl || true; \
$(MKDIR) test-db test-repl test-repl/r1 test-repl/r2 test-repl/p1 test-repl/p2 test-repl/p3 || true; \
$(srcdir)/scripts/all $(srcdir) ldbm $(BUILD_LDBM) $(BUILD_MONITOR); \
else \
echo "run configure with --enable-ldbm" ; \

View File

@ -8,8 +8,8 @@ include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
#
pidfile ./test-repl/slapd.pid
argsfile ./test-repl/slapd.args
pidfile ./test-repl/p1/slapd.pid
argsfile ./test-repl/p1/slapd.args
modulepath ../servers/slapd/back-@BACKEND@/
@MODULELOAD@
@ -21,7 +21,7 @@ modulepath ../servers/slapd/back-@BACKEND@/
database @BACKEND@
#ldbm#cachesize 0
suffix "o=University of Michigan,c=US"
directory ./test-repl
directory ./test-repl/p1
rootdn "cn=Replica,o=University of Michigan,c=US"
rootpw secret
#ldbm#index objectClass eq

View File

@ -0,0 +1,44 @@
# $OpenLDAP$
#
# slave slapd config -- for testing of SYNC replication
#
ucdata-path ./ucdata
include ./schema/core.schema
include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
#
pidfile ./test-repl/p2/slapd.pid
argsfile ./test-repl/p2/slapd.args
modulepath ../servers/slapd/back-@BACKEND@/
@MODULELOAD@
#######################################################################
# ldbm database definitions
#######################################################################
database @BACKEND@
#ldbm#cachesize 0
suffix "o=University of Michigan,c=US"
directory ./test-repl/p2
rootdn "cn=Replica,o=University of Michigan,c=US"
rootpw secret
#ldbm#index objectClass eq
#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
# Don't change syncrepl spec yet
syncrepl id=1
provider=ldap://localhost:9013
updatedn="cn=Replica,o=University of Michigan,c=US"
binddn="cn=Replica,o=University of Michigan,c=US"
bindmethod=simple
credentials=secret
searchbase="o=University of Michigan,c=US"
filter="(objectClass=*)"
attrs="*"
lastmod=req
scope=sub
type=refreshAndPersist

View File

@ -0,0 +1,44 @@
# $OpenLDAP$
#
# slave slapd config -- for testing of SYNC replication
#
ucdata-path ./ucdata
include ./schema/core.schema
include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
#
pidfile ./test-repl/p3/slapd.pid
argsfile ./test-repl/p3/slapd.args
modulepath ../servers/slapd/back-@BACKEND@/
@MODULELOAD@
#######################################################################
# ldbm database definitions
#######################################################################
database @BACKEND@
#ldbm#cachesize 0
suffix "o=University of Michigan,c=US"
directory ./test-repl/p3
rootdn "cn=Replica,o=University of Michigan,c=US"
rootpw secret
#ldbm#index objectClass eq
#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
# Don't change syncrepl spec yet
syncrepl id=1
provider=ldap://localhost:9009
updatedn="cn=Replica,o=University of Michigan,c=US"
binddn="cn=Manager,o=University of Michigan,c=US"
bindmethod=simple
credentials=secret
searchbase="o=University of Michigan,c=US"
filter="(objectClass=*)"
attrs="*"
lastmod=req
scope=sub
type=refreshAndPersist

View File

@ -8,8 +8,8 @@ include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
#
pidfile ./test-repl/slapd.pid
argsfile ./test-repl/slapd.args
pidfile ./test-repl/r1/slapd.pid
argsfile ./test-repl/r1/slapd.args
modulepath ../servers/slapd/back-@BACKEND@/
@MODULELOAD@
@ -21,7 +21,7 @@ modulepath ../servers/slapd/back-@BACKEND@/
database @BACKEND@
#ldbm#cachesize 0
suffix "o=University of Michigan,c=US"
directory ./test-repl
directory ./test-repl/r1
rootdn "cn=Replica,o=University of Michigan,c=US"
rootpw secret
#ldbm#index objectClass eq

View File

@ -0,0 +1,45 @@
# $OpenLDAP$
#
# slave slapd config -- for testing of SYNC replication
#
ucdata-path ./ucdata
include ./schema/core.schema
include ./schema/cosine.schema
include ./schema/inetorgperson.schema
include ./schema/openldap.schema
#
pidfile ./test-repl/r2/slapd.pid
argsfile ./test-repl/r2/slapd.args
modulepath ../servers/slapd/back-@BACKEND@/
@MODULELOAD@
#######################################################################
# ldbm database definitions
#######################################################################
database @BACKEND@
#ldbm#cachesize 0
suffix "o=University of Michigan,c=US"
directory ./test-repl/r2
rootdn "cn=Replica,o=University of Michigan,c=US"
rootpw secret
#ldbm#index objectClass eq
#ldbm#index cn,sn,uid pres,eq,sub
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
# Don't change syncrepl spec yet
syncrepl id=1
provider=ldap://localhost:9011
updatedn="cn=Replica,o=University of Michigan,c=US"
binddn="cn=Replica,o=University of Michigan,c=US"
bindmethod=simple
credentials=secret
searchbase="o=University of Michigan,c=US"
filter="(objectClass=*)"
attrs="*"
lastmod=req
scope=sub
type=refreshOnly
interval=10

View File

@ -5,6 +5,11 @@ DATADIR=$SRCDIR/data
PROGDIR=./progs
DBDIR=./test-db
REPLDIR=./test-repl
R1REPLDIR=$REPLDIR/r1
R2REPLDIR=$REPLDIR/r2
P1REPLDIR=$REPLDIR/p1
P2REPLDIR=$REPLDIR/p2
P3REPLDIR=$REPLDIR/p3
CACHEDIR=./test-cache
CONF=$DATADIR/slapd.conf
@ -17,8 +22,11 @@ SRMASTERCONF=$DATADIR/slapd-syncrepl-master.conf
SLAVECONF=$DATADIR/slapd-repl-slave.conf
PROXYCACHECONF=$DATADIR/slapd-proxycache.conf
CACHEMASTERCONF=$DATADIR/slapd-cache-master.conf
SRREFSLAVECONF=$DATADIR/slapd-syncrepl-slave-refresh.conf
SRPERSLAVECONF=$DATADIR/slapd-syncrepl-slave-persist.conf
R1SRSLAVECONF=$DATADIR/slapd-syncrepl-slave-refresh1.conf
R2SRSLAVECONF=$DATADIR/slapd-syncrepl-slave-refresh2.conf
P1SRSLAVECONF=$DATADIR/slapd-syncrepl-slave-persist1.conf
P2SRSLAVECONF=$DATADIR/slapd-syncrepl-slave-persist2.conf
P3SRSLAVECONF=$DATADIR/slapd-syncrepl-slave-persist3.conf
REFSLAVECONF=$DATADIR/slapd-ref-slave.conf
SUBMASTERCONF=$DATADIR/slapd-repl-submaster.conf
SUBSLAVECONF=$DATADIR/slapd-repl-subslave.conf
@ -28,6 +36,11 @@ GLUECONF=$DATADIR/slapd-glue.conf
DBCONF=$DBDIR/slapd.conf
ADDCONF=$DBDIR/slapadd.conf
REPLCONF=$REPLDIR/slapd.conf
R1REPLCONF=$R1REPLDIR/slapd.conf
R2REPLCONF=$R2REPLDIR/slapd.conf
P1REPLCONF=$P1REPLDIR/slapd.conf
P2REPLCONF=$P2REPLDIR/slapd.conf
P3REPLCONF=$P3REPLDIR/slapd.conf
CACHECONF=$CACHEDIR/slapd.conf
TOOLARGS="-x $LDAP_TOOLARGS"
@ -67,8 +80,18 @@ LVL=${SLAPD_DEBUG-261}
LOCALHOST=localhost
PORT=9009
SLAVEPORT=9010
R1SLAVEPORT=9011
R2SLAVEPORT=9012
P1SLAVEPORT=9013
P2SLAVEPORT=9014
P3SLAVEPORT=9015
MASTERURI="ldap://${LOCALHOST}:$PORT/"
SLAVEURI="ldap://${LOCALHOST}:$SLAVEPORT/"
R1SLAVEURI="ldap://${LOCALHOST}:$R1SLAVEPORT/"
R2SLAVEURI="ldap://${LOCALHOST}:$R2SLAVEPORT/"
P1SLAVEURI="ldap://${LOCALHOST}:$P1SLAVEPORT/"
P2SLAVEURI="ldap://${LOCALHOST}:$P2SLAVEPORT/"
P3SLAVEURI="ldap://${LOCALHOST}:$P3SLAVEPORT/"
LDIF=$DATADIR/test.ldif
LDIFGLUED=$DATADIR/test-glued.ldif
LDIFORDERED=$DATADIR/test-ordered.ldif
@ -91,15 +114,30 @@ BJORNSDN="cn=Bjorn Jensen,ou=Information Technology DivisioN,OU=People,o=Univers
JAJDN="cn=James A Jones 1,ou=Alumni Association,ou=People,o=University of Michigan,c=US"
MASTERLOG=$DBDIR/master.log
SLAVELOG=$DBDIR/slave.log
R1SLAVELOG=$DBDIR/r1.log
R2SLAVELOG=$DBDIR/r2.log
P1SLAVELOG=$DBDIR/p1.log
P2SLAVELOG=$DBDIR/p2.log
P3SLAVELOG=$DBDIR/p3.log
SLURPLOG=$DBDIR/slurp.log
SEARCHOUT=$DBDIR/ldapsearch.out
SEARCHFLT=$DBDIR/ldapsearch.flt
LDIFFLT=$DBDIR/ldif.flt
R1LDIFFLT=$DBDIR/r1ldif.flt
R2LDIFFLT=$DBDIR/r2ldif.flt
P1LDIFFLT=$DBDIR/p1ldif.flt
P2LDIFFLT=$DBDIR/p2ldif.flt
P3LDIFFLT=$DBDIR/p3ldif.flt
SUBFLT0=$DBDIR/sub0.flt
SUBFLT1=$DBDIR/sub1.flt
SUBFLT2=$DBDIR/sub2.flt
MASTEROUT=$DBDIR/master.out
SLAVEOUT=$DBDIR/slave.out
R1SLAVEOUT=$DBDIR/r1.out
R2SLAVEOUT=$DBDIR/r2.out
P1SLAVEOUT=$DBDIR/p1.out
P2SLAVEOUT=$DBDIR/p2.out
P3SLAVEOUT=$DBDIR/p3.out
SUBMASTEROUT=$DBDIR/submaster.out
TESTOUT=$DBDIR/test.out
INITOUT=$DBDIR/init.out

View File

@ -27,8 +27,8 @@ echo "running defines.sh"
echo "Cleaning up in $DBDIR..."
rm -f $DBDIR/[!C]*
echo "Cleaning up in $REPLDIR..."
rm -rf $REPLDIR/[!C]*
echo "Cleaning up in $R1REPLDIR..."
rm -rf $R1REPLDIR/[!C]*
echo "Starting master slapd on TCP/IP port $PORT..."
. $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
@ -64,18 +64,18 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $SRREFSLAVECONF > $REPLCONF
$SLAPD -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
SLAVEPID=$!
echo "Starting slave slapd on TCP/IP port $R1SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
$SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
R1SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVEPID $SLAVEPID
echo SLAVEPID $R1SLAVEPID
read foo
fi
echo "Using ldapsearch to check that slave slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $SLAVEPORT \
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R1SLAVEPORT \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
@ -192,28 +192,28 @@ if test $RC != 0 ; then
fi
echo "Using ldapsearch to read all the entries from the slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
'objectclass=*' > $SLAVEOUT 2>&1
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R1SLAVEPORT \
'objectclass=*' > $R1SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at slave ($RC)!"
kill -HUP $PID $SLAVEPID
kill -HUP $PID $R1SLAVEPID
exit $RC
fi
kill -HUP $PID $SLAVEPID
kill -HUP $PID $R1SLAVEPID
SEARCHOUT=$MASTEROUT
LDIF=$SLAVEOUT
LDIF=$R1SLAVEOUT
echo "Filtering ldapsearch results..."
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Filtering original ldif used to create database..."
. $LDIFFILTER < $LDIF > $LDIFFLT
. $LDIFFILTER < $LDIF > $R1LDIFFLT
echo "Comparing retrieved entries from master and slave..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
$CMP $SEARCHFLT $R1LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and slave databases differ"

View File

@ -27,8 +27,8 @@ echo "running defines.sh"
echo "Cleaning up in $DBDIR..."
rm -f $DBDIR/[!C]*
echo "Cleaning up in $REPLDIR..."
rm -rf $REPLDIR/[!C]*
echo "Cleaning up in $P1REPLDIR..."
rm -rf $P1REPLDIR/[!C]*
echo "Starting master slapd on TCP/IP port $PORT..."
. $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
@ -64,18 +64,18 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Starting slave slapd on TCP/IP port $SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $SRPERSLAVECONF > $REPLCONF
$SLAPD -f $REPLCONF -h $SLAVEURI -d $LVL $TIMING > $SLAVELOG 2>&1 &
SLAVEPID=$!
echo "Starting slave slapd on TCP/IP port $P1SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
$SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
P1SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVEPID $SLAVEPID
echo SLAVEPID $P1SLAVEPID
read foo
fi
echo "Using ldapsearch to check that slave slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $SLAVEPORT \
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P1SLAVEPORT \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
@ -192,28 +192,28 @@ if test $RC != 0 ; then
fi
echo "Using ldapsearch to read all the entries from the slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
'objectclass=*' > $SLAVEOUT 2>&1
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P1SLAVEPORT \
'objectclass=*' > $P1SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at slave ($RC)!"
kill -HUP $PID $SLAVEPID
kill -HUP $PID $P1SLAVEPID
exit $RC
fi
kill -HUP $PID $SLAVEPID
kill -HUP $PID $P1SLAVEPID
SEARCHOUT=$MASTEROUT
LDIF=$SLAVEOUT
LDIF=$P1SLAVEOUT
echo "Filtering ldapsearch results..."
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Filtering original ldif used to create database..."
. $LDIFFILTER < $LDIF > $LDIFFLT
. $LDIFFILTER < $LDIF > $P1LDIFFLT
echo "Comparing retrieved entries from master and slave..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
$CMP $SEARCHFLT $P1LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and slave databases differ"

View File

@ -0,0 +1,415 @@
#! /bin/sh
# $OpenLDAP$
SRCDIR="."
if test $# -ge 1 ; then
SRCDIR=$1; shift
fi
. $SRCDIR/scripts/args.sh $*
if test "$BACKEND" != "bdb" -a "$BACKEND" != "hdb"; then
echo "Test only valid for back-bdb"
exit 0
fi
echo "running defines.sh"
. $SRCDIR/scripts/defines.sh
#
# Test replication:
# - start master
# - start slave
# - populate over ldap
# - perform some modifies and deleted
# - retrieve database over ldap and compare against expected results
#
echo "Cleaning up in $DBDIR..."
rm -f $DBDIR/[!C]*
echo "Cleaning up in $R1REPLDIR..."
rm -rf $R1REPLDIR/[!C]*
echo "Cleaning up in $R2REPLDIR..."
rm -rf $R2REPLDIR/[!C]*
echo "Cleaning up in $P1REPLDIR..."
rm -rf $P1REPLDIR/[!C]*
echo "Cleaning up in $P2REPLDIR..."
rm -rf $P2REPLDIR/[!C]*
echo "Cleaning up in $P3REPLDIR..."
rm -rf $P3REPLDIR/[!C]*
echo "Starting master slapd on TCP/IP port $PORT..."
. $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
$SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
echo "Waiting 5 seconds to wait for master to start..."
sleep 5
echo "Using ldapsearch to check that master slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
'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 ldapadd to create the context prefix entry in the master..."
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
$LDIFORDEREDCP > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed ($RC)!"
kill -HUP $PID
exit $RC
fi
echo "Starting R1 slave slapd on TCP/IP port $R1SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
$SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
R1SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVE R1 PID $R1SLAVEPID
read foo
fi
echo "Using ldapsearch to check that R1 slave slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R1SLAVEPORT \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for R1 slapd to start..."
sleep 5
done
echo "Waiting for the R1 slave to replicate..."
sleep 10
echo "Starting R2 slave slapd on TCP/IP port $R2SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $R2SRSLAVECONF > $R2REPLCONF
$SLAPD -f $R2REPLCONF -h $R2SLAVEURI -d $LVL $TIMING > $R2SLAVELOG 2>&1 &
R2SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVE R2 PID $R2SLAVEPID
read foo
fi
echo "Using ldapsearch to check that the R2 slave slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R2SLAVEPORT \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for R2 slave slapd to start..."
sleep 5
done
echo "Waiting for the R2 slave to replicate..."
sleep 10
echo "Starting P1 slave slapd on TCP/IP port $P1SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
$SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
P1SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVE P1 PID $P1SLAVEPID
read foo
fi
echo "Using ldapsearch to check that the P1 slave slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P1SLAVEPORT \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for P1 slave slapd to start..."
sleep 5
done
echo "Waiting for the P1 slave to replicate..."
sleep 10
echo "Starting P2 slave slapd on TCP/IP port $P2SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $P2SRSLAVECONF > $P2REPLCONF
$SLAPD -f $P2REPLCONF -h $P2SLAVEURI -d $LVL $TIMING > $P2SLAVELOG 2>&1 &
P2SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVE P2 PID $P2SLAVEPID
read foo
fi
echo "Using ldapsearch to check that the P2 slave slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P2SLAVEPORT \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for P2 slave slapd to start..."
sleep 5
done
echo "Starting P3 slave slapd on TCP/IP port $P3SLAVEPORT..."
. $CONFFILTER $BACKEND $MONITORDB < $P3SRSLAVECONF > $P3REPLCONF
$SLAPD -f $P3REPLCONF -h $P3SLAVEURI -d $LVL $TIMING > $P3SLAVELOG 2>&1 &
P3SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVE P3 PID $P3SLAVEPID
read foo
fi
echo "Using ldapsearch to check that the P3 slave slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P3SLAVEPORT \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for P3 slave slapd to start..."
sleep 5
done
echo "Using ldapadd to populate the master directory..."
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
$LDIFORDEREDNOCP > /dev/null 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed ($RC)!"
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
exit $RC
fi
echo "Waiting 30 seconds for syncrepl to receive changes..."
sleep 30
echo "Using ldapmodify to modify master directory..."
#
# Do some modifications
#
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
$TESTOUT 2>&1 << EOMODS
dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
changetype: modify
add: drink
drink: Orange Juice
-
delete: sn
sn: Jones
-
add: sn
sn: Jones
dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
changetype: modify
replace: drink
drink: Iced Tea
drink: Mad Dog 20/20
dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
changetype: modify
delete: member
member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
-
add: member
member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
changetype: modify
delete: description
dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
changetype: add
objectclass: OpenLDAPperson
cn: Gern Jensen
sn: Jensen
uid: gjensen
title: Chief Investigator, ITD
postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
drink: Coffee
homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
description: Very odd
facsimiletelephonenumber: +1 313 555 7557
telephonenumber: +1 313 555 8343
mail: gjensen@mailgw.example.com
homephone: +1 313 555 8844
dn: ou=Retired, ou=People, o=University of Michigan, c=US
changetype: add
objectclass: organizationalUnit
ou: Retired
dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
changetype: add
objectclass: OpenLDAPperson
cn: Rosco P. Coltrane
sn: Coltrane
uid: rosco
dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
changetype: modrdn
newrdn: cn=Rosco P. Coltrane
deleteoldrdn: 1
newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
changetype: delete
EOMODS
echo "Waiting 30 seconds for syncrepl to receive changes..."
sleep 30
echo "Using ldapsearch to read all the entries from the master..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
'objectclass=*' > $MASTEROUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at master ($RC)!"
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
exit $RC
fi
echo "Using ldapsearch to read all the entries from the R1 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R1SLAVEPORT \
'objectclass=*' > $R1SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at R1 slave ($RC)!"
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
exit $RC
fi
echo "Using ldapsearch to read all the entries from the R2 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R2SLAVEPORT \
'objectclass=*' > $R2SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at R2 slave ($RC)!"
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
exit $RC
fi
echo "Using ldapsearch to read all the entries from the P1 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P1SLAVEPORT \
'objectclass=*' > $P1SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at R1 slave ($RC)!"
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
exit $RC
fi
echo "Using ldapsearch to read all the entries from the P2 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P2SLAVEPORT \
'objectclass=*' > $P2SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at R2 slave ($RC)!"
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
exit $RC
fi
echo "Using ldapsearch to read all the entries from the P3 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P3SLAVEPORT \
'objectclass=*' > $P3SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at R2 slave ($RC)!"
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
exit $RC
fi
kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
SEARCHOUT=$MASTEROUT
R1LDIF=$R1SLAVEOUT
R2LDIF=$R2SLAVEOUT
P1LDIF=$P1SLAVEOUT
P2LDIF=$P2SLAVEOUT
P3LDIF=$P3SLAVEOUT
echo "Filtering master ldapsearch results..."
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Filtering R1 slave ldapsearch results..."
. $LDIFFILTER < $R1LDIF > $R1LDIFFLT
echo "Filtering R2 slave ldapsearch results..."
. $LDIFFILTER < $R2LDIF > $R2LDIFFLT
echo "Filtering P1 slave ldapsearch results..."
. $LDIFFILTER < $P1LDIF > $P1LDIFFLT
echo "Filtering P2 slave ldapsearch results..."
. $LDIFFILTER < $P2LDIF > $P2LDIFFLT
echo "Filtering P3 slave ldapsearch results..."
. $LDIFFILTER < $P3LDIF > $P3LDIFFLT
echo "Comparing retrieved entries from master and R1 slave..."
$CMP $SEARCHFLT $R1LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and R1 slave databases differ"
exit 1
fi
echo "Comparing retrieved entries from master and R2 slave..."
$CMP $SEARCHFLT $R2LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and R2 slave databases differ"
exit 1
fi
echo "Comparing retrieved entries from master and P1 slave..."
$CMP $SEARCHFLT $P1LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and P1 slave databases differ"
exit 1
fi
echo "Comparing retrieved entries from master and P2 slave..."
$CMP $SEARCHFLT $P2LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and P2 slave databases differ"
exit 1
fi
echo "Comparing retrieved entries from master and P3 slave..."
$CMP $SEARCHFLT $P2LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and P3 slave databases differ"
exit 1
fi
echo ">>>>> Test succeeded"
exit 0