]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test050-syncrepl-multimaster
ITS#5189
[openldap] / tests / scripts / test050-syncrepl-multimaster
index 6bc522a7dc71622700635e8a17a626324ce49eda..ee2989c45d2ad3db64f12d7755b3cca842014d2b 100755 (executable)
@@ -27,11 +27,11 @@ DBPRO=$PRODIR/db
 DBCON=$CONDIR/db
 CFPRO=$PRODIR/slapd.d
 CFCON=$CONDIR/slapd.d
-LOG1=slapd.1.log
-LOG2=slapd.2.log
 
 mkdir -p $TESTDIR $PRODIR $CONDIR $DBPRO $DBCON $CFPRO $CFCON
 
+$SLAPPASSWD -g -n >$CONFIGPWF
+
 #
 # Test replication of dynamic config:
 # - start producer
@@ -43,19 +43,40 @@ mkdir -p $TESTDIR $PRODIR $CONDIR $DBPRO $DBCON $CFPRO $CFCON
 #
 
 echo "Initializing server configurations..."
-$SLAPADD -F $CFPRO -n 0 -l $DYNAMICCONF
-$SLAPADD -F $CFCON -n 0 -l $DYNAMICCONF
+$SLAPADD -F $CFCON -n 0 <<EOF
+dn: cn=config
+objectClass: olcGlobal
+cn: config
+olcServerID: 2
+
+dn: olcDatabase={0}config,cn=config
+objectClass: olcDatabaseConfig
+olcDatabase: {0}config
+olcRootPW:< file://$CONFIGPWF
+EOF
+
+$SLAPADD -F $CFPRO -n 0 <<EOF
+dn: cn=config
+objectClass: olcGlobal
+cn: config
+olcServerID: 1
+
+dn: olcDatabase={0}config,cn=config
+objectClass: olcDatabaseConfig
+olcDatabase: {0}config
+olcRootPW:< file://$CONFIGPWF
+EOF
 
 echo "Starting producer slapd on TCP/IP port $PORT1..."
 cd $PRODIR
-$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING > ../$LOG1 2>&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 ../..
+cd $TESTWD
 
 sleep 1
 
@@ -100,15 +121,11 @@ fi
 # neither server will progress. The timeout will drop the syncrepl
 # attempt and allow the modifies to complete.
 #
-# Setting the ServerIDs after the fact is bogus; the entries that
-# were created before this point all have SID 0 in their CSNs. Still
-# that should be harmless.
-#
-CONFIGPW=`cat $CONFIGPWF`
+read CONFIGPW < $CONFIGPWF
 $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >> $TESTOUT 2>&1
 dn: cn=config
 changetype: modify
-add: olcServerID
+replace: olcServerID
 olcServerID: 1 $URI1
 olcServerID: 2 $URI2
 
@@ -140,14 +157,14 @@ fi
 
 echo "Starting consumer slapd on TCP/IP port $PORT2..."
 cd $CONDIR
-$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > ../$LOG2 2>&1 &
+$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
 SLAVEPID=$!
 if test $WAIT != 0 ; then
     echo SLAVEPID $SLAVEPID
     read foo
 fi
 KILLPIDS="$KILLPIDS $SLAVEPID"
-cd ../..
+cd $TESTWD
 
 sleep 1
 
@@ -187,15 +204,15 @@ EOF
 
 echo "Adding schema and databases on producer..."
 $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
-include: file:$SCHEMADIR/core.ldif
+include: file://$ABS_SCHEMADIR/core.ldif
 
-include: file:$SCHEMADIR/cosine.ldif
+include: file://$ABS_SCHEMADIR/cosine.ldif
 
-include: file:$SCHEMADIR/inetorgperson.ldif
+include: file://$ABS_SCHEMADIR/inetorgperson.ldif
 
-include: file:$SCHEMADIR/openldap.ldif
+include: file://$ABS_SCHEMADIR/openldap.ldif
 
-include: file:$SCHEMADIR/nis.ldif
+include: file://$ABS_SCHEMADIR/nis.ldif
 EOF
 RC=$?
 if test $RC != 0 ; then
@@ -231,10 +248,10 @@ olcRootDN: $MANAGERDN
 olcRootPW: $PASSWD
 olcSyncRepl: rid=003 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
   credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
-  interval=00:00:00:10 retry="5 5 300 5"
+  interval=00:00:00:10 retry="5 5 300 5" timeout=1
 olcSyncRepl: rid=004 provider=$URI2 binddn="$MANAGERDN" bindmethod=simple
   credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
-  interval=00:00:00:10 retry="5 5 300 5"
+  interval=00:00:00:10 retry="5 5 300 5" timeout=1
 olcMirrorMode: TRUE
 
 dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
@@ -362,15 +379,15 @@ test $KILLSERVERS != no && wait
 echo "Restarting servers..."
 echo "Starting producer slapd on TCP/IP port $PORT1..."
 cd $PRODIR
-echo "======================= RESTART =======================" >> ../$LOG1
-$SLAPD -F ./slapd.d -h $URI1 -d $LVL $TIMING >> ../$LOG1 2>&1 &
+echo "======================= RESTART =======================" >> $LOG1
+$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 ../..
+cd $TESTWD
 echo "Using ldapsearch to check that producer slapd is running..."
 for i in 0 1 2 3 4 5; do
        $LDAPSEARCH -s base -b "" -H $URI1 \
@@ -391,15 +408,15 @@ fi
 #exit 0
 echo "Starting consumer slapd on TCP/IP port $PORT2..."
 cd $CONDIR
-echo "======================= RESTART =======================" >> ../$LOG2
-$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> ../$LOG2 2>&1 &
+echo "======================= RESTART =======================" >> $LOG2
+$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
 SLAVEPID=$!
 if test $WAIT != 0 ; then
     echo SLAVEPID $SLAVEPID
     read foo
 fi
 KILLPIDS="$KILLPIDS $SLAVEPID"
-cd ../..
+cd $TESTWD
 
 sleep 1