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

ITS#8521 - Updates to test to ensure it fails where it should fail and...

ITS#8521 - Updates to test to ensure it fails where it should fail and succeeds where it should succeed.
Reference ITS#8281 as well, since these are related
parent b61f7a25
......@@ -21,9 +21,12 @@ if test $SYNCPROV = syncprovno; then
exit 0
fi
echo "This test tracks a case where a consumer fails to replicate from the provider"
echo "when the provider is dynamically configured for replication."
echo "See http://www.openldap.org/its/index.cgi/?findid=8521 for more information."
echo ""
echo " This test tracks a case where a consumer fails to replicate from the provider"
echo " when the provider is dynamically configured for replication."
echo " See http://www.openldap.org/its/index.cgi/?findid=8521 and"
echo " See http://www.openldap.org/its/index.cgi/?findid=8281 for more information."
echo ""
PRODIR=$TESTDIR/pro
CONDIR=$TESTDIR/con1
......@@ -133,12 +136,13 @@ dc: users
objectClass: domain
objectClass: top
dn: cn=Johndoe,dc=users,dc=example,dc=com
dn: uid=johndoe,dc=users,dc=example,dc=com
changetype: add
objectClass: person
objectClass: inetOrgPerson
objectClass: top
sn: John Doe
sn: Doe
cn: Johndoe
uid: johndoe
dn: cn=replicator,ou=LDAPRoles,dc=example,dc=com
objectClass: top
......@@ -213,8 +217,8 @@ changetype: modify
add: olcSyncrepl
olcSyncrepl: rid=100 provider=$URI1 bindmethod=simple
binddn="cn=replicator,ou=LDAPRoles,dc=example,dc=com" credentials=secret
type=refreshOnly searchbase="dc=example,dc=com" filter="(objectclass=*)"
scope=sub schemachecking=on retry="5 10 60 +" sizeLimit=unlimited
type=refreshAndPersist searchbase="dc=example,dc=com" filter="(objectclass=*)"
scope=sub schemachecking=on interval=5 retry="5 +" sizeLimit=unlimited
timelimit=unlimited
-
......@@ -226,81 +230,59 @@ if test $RC != 0 ; then
exit $RC
fi
#### See if restarting provider makes any differnce (It doesn't) ####
echo "Stopping provider to test recovery..."
kill -INT $PID
echo "Sleeping 10 seconds to allow replication to initiate..."
sleep 10
echo "Restarting provider..."
echo "RESTART" >> $LOG1
$SLAPD -F $CFPRO -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
KILLPIDS="$PID $SLAVEPID"
sleep 1
echo "Using ldapsearch to check that provider slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "" -H $URI1 \
'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 ldapsearch to read all the entries from the provider..."
$LDAPSEARCH -S "" -D $MANAGERDN -w $PASSWD -b "$BASEDN" -H $URI1 \
'(objectclass=*)' '*' $OPATTRS > $MASTEROUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
echo "ldapsearch failed at provider ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
#### END TEST LINES ####
#### See if restarting consumer makes any differnce (It doesn't) ####
echo "Stopping consumer to test recovery..."
kill -INT $SLAVEPID
sleep 10
echo "Using ldapsearch to read all the entries from the consumer..."
$LDAPSEARCH -S "" -D $MANAGERDN -w $PASSWD -b "$BASEDN" -H $URI2 \
'(objectclass=*)' '*' $OPATTRS > $SLAVEOUT 2>&1
RC=$?
echo "Restarting consumer..."
echo "RESTART" >> $LOG2
$SLAPD -F $CFCON -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
SLAVEPID=$!
if test $WAIT != 0 ; then
echo SLAVEPID $SLAVEPID
read foo
if test $RC == 0 ; then
echo "ldapsearch succeeded at consumer ($RC)!"
echo "This is a regression of ITS8281"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
KILLPIDS="$PID $SLAVEPID"
sleep 1
echo "Using ldapsearch to check that consumer slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "" -H $URI2 \
'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 "Filtering provider results..."
$LDIFFILTER < $MASTEROUT > $MASTERFLT
echo "Filtering consumer results..."
$LDIFFILTER < $SLAVEOUT > $SLAVEFLT
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
echo "Comparing retrieved entries from provider and consumer..."
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
if test $? == 0 ; then
echo "test failed - provider and consumer databases match"
echo "This is a regression of ITS8281"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
exit 1
fi
echo "Sleeping 30 seconds to allow replication to initiate..."
echo "Modifying provider to force generation of a contextCSN"
$LDAPMODIFY -v -D "$MANAGERDN" -H $URI1 -w $PASSWD > \
$TESTOUT 2>&1 << EOMODS
dn: uid=Johndoe,dc=users,dc=example,dc=com
changetype: modify
replace: cn
cn: John Doe
EOMODS
echo "Sleeping 30 seconds to allow consumer to reconnect and replicate..."
sleep 30
#### END TEST LINES ####
echo "Using ldapsearch to read all the entries from the provider..."
$LDAPSEARCH -S "" -D $MANAGERDN -w $PASSWD -b "$BASEDN" -H $URI1 \
......@@ -324,7 +306,6 @@ if test $RC != 0 ; then
exit $RC
fi
test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo "Filtering provider results..."
$LDIFFILTER < $MASTEROUT > $MASTERFLT
......@@ -336,9 +317,12 @@ $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - provider and consumer databases differ"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo
echo ">>>>> Test succeeded"
......
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