]> git.sur5r.net Git - openldap/blobdiff - tests/scripts/test007-replication
Delete unused idl_cache_entry rwlock field
[openldap] / tests / scripts / test007-replication
index 527c0013543c67757b5d4a4136b184c8b8fd2cc2..4ae4e89bd30cadee6c70ae885037f65a3df7197c 100755 (executable)
@@ -2,7 +2,7 @@
 # $OpenLDAP$
 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 ##
-## Copyright 1998-2005 The OpenLDAP Foundation.
+## Copyright 1998-2007 The OpenLDAP Foundation.
 ## All rights reserved.
 ##
 ## Redistribution and use in source and binary forms, with or without
@@ -17,7 +17,7 @@ echo "running defines.sh"
 . $SRCDIR/scripts/defines.sh
 
 if test ! -x $SLURPD ; then
-       echo ">>>>> $SLURPD is not executable or do not exist."
+       echo ">>>>> $SLURPD is not executable or does not exist."
        echo ">>>>> Test skipped."
        exit 0
 fi
@@ -55,6 +55,8 @@ if test $WAIT != 0 ; then
 fi
 KILLPIDS="$KILLPIDS $SLAVEPID"
 
+sleep 1
+
 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 $PORT1 \
@@ -192,13 +194,13 @@ echo "Waiting 15 seconds for slurpd to send changes..."
 sleep 15
 
 echo "Stopping the slave..."
-kill $SLAVEPID
+kill -HUP $SLAVEPID
 KILLPIDS="$PID $SLURPPID"
 
-echo "Waiting 5 seconds for slave slapd to die..."
-sleep 5
+echo "Waiting for slave slapd to die..."
+wait $SLAVEPID
 
-echo "Applying more changes..."
+echo "Applying more changes to the master slapd..."
 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
        $TESTOUT 2>&1 << EOMODS
 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
@@ -218,13 +220,13 @@ fi
 
 
 echo "Stopping slurpd..."
-kill $SLURPPID
+kill -HUP $SLURPPID
 KILLPIDS="$PID"
 
-echo "Waiting 5 seconds for slurpd to die..."
-sleep 5
+echo "Waiting for slurpd to die..."
+wait $SLURPPID
 
-echo "Applying more changes..."
+echo "Applying more changes to the master slapd..."
 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
        $TESTOUT 2>&1 << EOMODS
 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
@@ -243,6 +245,7 @@ if test $RC != 0 ; then
 fi
 
 echo "Restarting slave slapd on TCP/IP port $PORT2..."
+echo "RESTART" >> $LOG2
 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
 SLAVEPID=$!
 if test $WAIT != 0 ; then
@@ -251,6 +254,8 @@ if test $WAIT != 0 ; then
 fi
 KILLPIDS="$KILLPIDS $SLAVEPID"
 
+sleep 1
+
 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 $PORT2 \
@@ -263,7 +268,8 @@ for i in 0 1 2 3 4 5; do
        sleep 5
 done
 
-echo "Starting slurpd..."
+echo "Restarting slurpd..."
+echo "RESTART" >> $SLURPLOG
 $SLURPD -f $CONF1 -d ${SLURPD_DEBUG-5} -t $DBDIR1B >> $SLURPLOG 2>&1 &
 SLURPPID=$!
 if test $WAIT != 0 ; then
@@ -275,9 +281,10 @@ KILLPIDS="$KILLPIDS $SLURPPID"
 echo "Waiting 15 seconds for slurpd to send changes..."
 sleep 15
 
-echo "Try updating the slave slapd..."
-$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD > \
-       $TESTOUT 2>&1 << EOMODS
+if test ! $BACKLDAP = "ldapno" ; then
+       echo "Try updating the slave slapd..."
+       $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD > \
+               $TESTOUT 2>&1 << EOMODS
 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
 changetype: modify
 add: description
@@ -286,26 +293,15 @@ description: unless the chain overlay is configured appropriately ;)
 
 EOMODS
 
-RC=$?
-
-if test $BACKLDAP = "ldapno" ; then
-       # expect 10 (LDAP_REFERRAL)...
-       if test $RC != 10 ; then
-               echo "ldapmodify should have failed ($RC)!"
-               test $KILLSERVERS != no && kill -HUP $KILLPIDS
-               exit $RC
-       fi
-
-else
-       # expect 0 (LDAP_SUCCESS)...
+       RC=$?
        if test $RC != 0 ; then
                echo "ldapmodify failed ($RC)!"
                test $KILLSERVERS != no && kill -HUP $KILLPIDS
                exit $RC
        fi
 
-       echo "Waiting 5 seconds for slurpd to send changes..."
-       sleep 5
+       echo "Waiting 15 seconds for slurpd to send changes..."
+       sleep 15
 fi
 
 echo "Using ldapsearch to read all the entries from the master..."
@@ -346,4 +342,7 @@ if test $? != 0 ; then
 fi
 
 echo ">>>>> Test succeeded"
+
+test $KILLSERVERS != no && wait
+
 exit 0