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
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
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
-
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 \
exit $RC
fi
-test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo "Filtering provider results..."
$LDIFFILTER < $MASTEROUT > $MASTERFLT
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"