Commit 7f4f759b authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

allow each (back-config) syncrepl test to use the preferred sync type, but...

allow each (back-config) syncrepl test to use the preferred sync type, but allow changing it via the -s switch for ./run
parent 61d71245
......@@ -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
......
......@@ -32,6 +32,22 @@ mkdir -p $TESTDIR $PRODIR $CONDIR $DBPRO $DBCON $CFPRO $CFCON
$SLAPPASSWD -g -n >$CONFIGPWF
if test x"$SYNCMODE" = x ; then
SYNCMODE=rp
fi
case "$SYNCMODE" in
ro)
SYNCTYPE="type=refreshOnly interval=00:00:00:10"
;;
rp)
SYNCTYPE="type=refreshAndPersist"
;;
*)
echo "unknown sync mode $SYNCMODE"
exit 1;
;;
esac
#
# Test replication of dynamic config:
# - start producer
......@@ -97,8 +113,8 @@ 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" type=refreshAndPersist
retry="5 5 300 5" timeout=3
-
add: olcUpdateRef
olcUpdateRef: $URI1
......@@ -154,8 +170,8 @@ 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" type=refreshAndPersist
retry="5 5 300 5" timeout=3
-
add: olcUpdateRef
olcUpdateRef: $URI1
......@@ -230,8 +246,8 @@ 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
retry="5 5 300 5" timeout=3
olcUpdateRef: $URI1
dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
......@@ -247,6 +263,24 @@ if test $RC != 0 ; then
exit $RC
fi
case $BACKEND in
bdb | hdb)
$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
dn: olcDatabase={1}$BACKEND,cn=config
changetype: modify
add: olcDbIndex
olcDbIndex: objectClass,entryUUID,entryCSN eq
olcDbIndex: cn,uid pres,eq,sub
EOF
RC=$?
if test $RC != 0 ; then
echo "ldapadd modify for database config ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
;;
esac
echo "Using ldapadd to populate producer..."
$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \
>> $TESTOUT 2>&1
......
......@@ -31,13 +31,26 @@ 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
fi
case "$SYNCMODE" in
ro)
SYNCTYPE="type=refreshOnly interval=00:00:00:10"
;;
rp)
SYNCTYPE="type=refreshAndPersist"
;;
*)
echo "unknown sync mode $SYNCMODE"
exit 1;
;;
esac
#
# Test replication of dynamic config:
# - start producer
......@@ -346,6 +359,24 @@ if test $RC != 0 ; then
exit $RC
fi
case $BACKEND in
bdb | hdb)
$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
dn: olcDatabase={1}$BACKEND,cn=config
changetype: modify
add: olcDbIndex
olcDbIndex: objectClass,entryUUID,entryCSN eq
olcDbIndex: cn,uid pres,eq,sub
EOF
RC=$?
if test $RC != 0 ; then
echo "ldapadd modify for database config ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
;;
esac
echo "Using ldapadd to populate producer..."
$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \
>> $TESTOUT 2>&1
......@@ -393,6 +424,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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment