]> git.sur5r.net Git - openldap/commitdiff
allow each (back-config) syncrepl test to use the preferred sync type, but allow...
authorPierangelo Masarati <ando@openldap.org>
Sat, 15 Nov 2008 15:05:12 +0000 (15:05 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 15 Nov 2008 15:05:12 +0000 (15:05 +0000)
tests/run.in
tests/scripts/test049-sync-config
tests/scripts/test050-syncrepl-multimaster
tests/scripts/test053-syncprov-glue

index e74a31083498c9906d1508d41a32defa5a13f850..476b5339baf6429fad068128a68ab6d6b09b24b3 100644 (file)
@@ -13,7 +13,7 @@
 ## top-level directory of the distribution or, alternatively, at
 ## <http://www.OpenLDAP.org/license.html>.
 
-USAGE="$0 [-b <backend>] [-c] [-k] [-p] [-u] [-w] <script>"
+USAGE="$0 [-b <backend>] [-c] [-k] [-p] [-s {ro|rp}] [-u] [-w] <script>"
 
 # configure generated
 SRCDIR="@srcdir@"
@@ -80,6 +80,7 @@ CLEAN=no
 WAIT=0
 KILLSERVERS=yes
 PRESERVE=${PRESERVE-no}
+SYNCMODE=
 USERDATA=no
 
 while test $# -gt 0 ; do
@@ -100,6 +101,18 @@ while test $# -gt 0 ; do
                        PRESERVE=yes
                        shift ;;
 
+               -s | -syncmode)
+                       case "$2" in
+                               ro | rp)
+                                       SYNCMODE="$2"
+                                       ;;
+                               *)
+                                       echo "unknown sync mode $2"
+                                       echo "$USAGE"; exit 1
+                                       ;;
+                       esac
+                       shift; shift ;;
+
                -u | -userdata)
                        USERDATA=yes
                        shift ;;
@@ -137,7 +150,7 @@ BACKENDTYPE=`eval 'echo $AC_'$BACKEND`
 if test "x$BACKENDTYPE" = "x" ; then
        BACKENDTYPE="unknown"
 fi
-export BACKEND BACKENDTYPE WAIT KILLSERVERS PRESERVE USERDATA
+export BACKEND BACKENDTYPE WAIT KILLSERVERS PRESERVE SYNCMODE USERDATA
 
 if test $# = 0 ; then
        echo "$USAGE"; exit 1
index 168935f0315c171d1ed5cc77ae7455fc3bbda6f3..b56c355f8ffc00f411b010bd80816b8c6b5fad7f 100755 (executable)
@@ -32,6 +32,23 @@ mkdir -p $TESTDIR $PRODIR $CONDIR $DBPRO $DBCON $CFPRO $CFCON
 
 $SLAPPASSWD -g -n >$CONFIGPWF
 
+if test x"$SYNCMODE" = x ; then
+       SYNCMODE=rp
+else
+       case "$SYNCMODE" in
+               ro)
+                       SYNCTYPE="type=refreshOnly interval=00:00:00:10"
+                       ;;
+               rp)
+                       SYNCTYPE="type=refreshAndPersist"
+                       ;;
+               *)
+                       echo "unknown sync mode $SYNCMODE"
+                       exit 1;
+                       ;;
+       esac
+fi
+
 #
 # Test replication of dynamic config:
 # - start producer
@@ -97,8 +114,7 @@ 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=refreshOnly
-  interval=00:00:00:10
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
 -
 add: olcUpdateRef
 olcUpdateRef: $URI1
@@ -154,8 +170,7 @@ 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=refreshOnly
-  interval=00:00:00:10
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
 -
 add: olcUpdateRef
 olcUpdateRef: $URI1
@@ -230,8 +245,7 @@ olcDbDirectory: ./db
 olcRootDN: $MANAGERDN
 olcRootPW: $PASSWD
 olcSyncRepl: rid=002 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
-  credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
-  interval=00:00:00:10
+  credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
 olcUpdateRef: $URI1
 
 dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
index bfedef953f8ca3f2bfba5ed5696a1e8cda737ed5..b06b46edaaef8bfd6c3282582d67a5eb033f3668 100755 (executable)
@@ -31,13 +31,27 @@ CFPRO=$PRODIR/slapd.d
 CFCON=$CONDIR/slapd.d
 CFCON2=$CONDIR2/slapd.d
 
-SYNCTYPE="type=refreshOnly interval=00:00:00:10"
-#SYNCTYPE="type=refreshAndPersist"
-
 mkdir -p $TESTDIR $PRODIR $CONDIR $CONDIR2 $DBPRO $DBCON $DBCON2 $CFPRO $CFCON $CFCON2
 
 $SLAPPASSWD -g -n >$CONFIGPWF
 
+if test x"$SYNCMODE" = x ; then
+       SYNCMODE=rp
+else
+       case "$SYNCMODE" in
+               ro)
+                       SYNCTYPE="type=refreshOnly interval=00:00:00:10"
+                       ;;
+               rp)
+                       SYNCTYPE="type=refreshAndPersist"
+                       ;;
+               *)
+                       echo "unknown sync mode $SYNCMODE"
+                       exit 1;
+                       ;;
+       esac
+fi
+
 #
 # Test replication of dynamic config:
 # - start producer
@@ -159,13 +173,13 @@ 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
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
-  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
-  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 -
 add: olcMirrorMode
@@ -215,13 +229,13 @@ 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
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
-  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
-  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 -
 add: olcMirrorMode
@@ -265,13 +279,13 @@ 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
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 olcSyncRepl: rid=002 provider=$URI2 binddn="cn=config" bindmethod=simple
-  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 olcSyncRepl: rid=003 provider=$URI3 binddn="cn=config" bindmethod=simple
-  credentials=$CONFIGPW searchbase="cn=config" type=refreshAndPersist
+  credentials=$CONFIGPW searchbase="cn=config" $SYNCTYPE
   retry="5 5 300 5" timeout=3
 -
 add: olcMirrorMode
@@ -393,6 +407,72 @@ SLEEP=20
 echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
 sleep $SLEEP
 
+echo "Using ldapmodify to add to the producer 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
+changetype: add
+objectClass: device
+# no distinguished values, will be added by DSA
+
+dn: cn=To be deleted by consumer1,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
+changetype: add
+objectClass: device
+# no distinguished values, will be added by DSA
+
+dn: cn=To be deleted by producer,dc=example,dc=com
+changetype: delete
+EOADDS
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapmodify failed for producer database ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+fi
+
+SLEEP=20
+echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
+sleep $SLEEP
+
+echo "Using ldapmodify to delete entries from consumer1..."
+$LDAPMODIFY -D "$MANAGERDN" -H $URI2 -w $PASSWD \
+       >> $TESTOUT 2>&1 << EOADDS
+dn: cn=To be deleted by consumer1,dc=example,dc=com
+changetype: delete
+EOADDS
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapmodify failed for consumer2 database ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+fi
+
+SLEEP=20
+echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
+sleep $SLEEP
+
+echo "Using ldapmodify to delete entries from consumer2..."
+$LDAPMODIFY -D "$MANAGERDN" -H $URI3 -w $PASSWD \
+       >> $TESTOUT 2>&1 << EOADDS
+dn: cn=To be deleted by consumer2,dc=example,dc=com
+changetype: delete
+EOADDS
+RC=$?
+if test $RC != 0 ; then
+       echo "ldapmodify failed for consumer2 database ($RC)!"
+       test $KILLSERVERS != no && kill -HUP $KILLPIDS
+       exit $RC
+fi
+
+SLEEP=20
+echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
+sleep $SLEEP
+
 echo "Using ldapsearch to check that syncrepl received database changes..."
 RC=32
 for i in 0 1 2 3 4 5; do
index e375c0a0f97219f9aae5558ed17294e131da7ec4..8c87fa053fc31f30e3310513bde00f30c848042c 100755 (executable)
@@ -45,6 +45,23 @@ KILLPIDS=
 
 $SLAPPASSWD -g -n >$CONFIGPWF
 
+if test x"$SYNCMODE" = x ; then
+       SYNCMODE=rp
+else
+       case "$SYNCMODE" in
+               ro)
+                       SYNCTYPE="type=refreshOnly interval=00:00:00:10"
+                       ;;
+               rp)
+                       SYNCTYPE="type=refreshAndPersist"
+                       ;;
+               *)
+                       echo "unknown sync mode $SYNCMODE"
+                       exit 1;
+                       ;;
+       esac
+fi
+
 echo "Initializing producer configurations..."
 $SLAPADD -F $CFPROD -n 0 <<EOF
 dn: cn=config
@@ -378,7 +395,7 @@ changetype: modify
 add: olcSyncRepl
 olcSyncRepl: rid=1 provider=$URI2 searchbase="ou=ou1,$BASEDN"
   binddn="$MANAGERDN" bindmethod=simple credentials=$PASSWD
-  type=refreshAndPersist retry="5 5 300 5" timeout=1
+  $SYNCTYPE retry="5 5 300 5" timeout=1
 
 EOF
 RC=$?
@@ -395,7 +412,7 @@ changetype: modify
 add: olcSyncRepl
 olcSyncRepl: rid=1 provider=$URI1 searchbase="$BASEDN"
   binddn="$MANAGERDN" bindmethod=simple credentials=$PASSWD
-  type=refreshAndPersist retry="5 5 300 5" timeout=1
+  $SYNCTYPE retry="5 5 300 5" timeout=1
 
 EOF
 RC=$?