From 88ffa89ae3daad9f924ddb22ba8b372135109ca9 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sun, 18 Apr 2010 06:00:29 +0000 Subject: [PATCH] fix syncrepl when attr has no matching rule (ITS#6458) --- tests/scripts/test018-syncreplication-persist | 139 +++++++++++++++++- 1 file changed, 135 insertions(+), 4 deletions(-) diff --git a/tests/scripts/test018-syncreplication-persist b/tests/scripts/test018-syncreplication-persist index 9b1059885c..f923341950 100755 --- a/tests/scripts/test018-syncreplication-persist +++ b/tests/scripts/test018-syncreplication-persist @@ -16,6 +16,8 @@ echo "running defines.sh" . $SRCDIR/scripts/defines.sh +OPATTRS="entryUUID creatorsName createTimestamp modifiersName modifyTimestamp" + if test $SYNCPROV = syncprovno; then echo "Syncrepl provider overlay not available, test skipped" exit 0 @@ -116,6 +118,42 @@ fi echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." sleep $SLEEP1 +echo "Using ldapsearch to read all the entries from the producer..." +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ + '(objectclass=*)' '*' $OPATTRS > $MASTEROUT 2>&1 +RC=$? + +if test $RC != 0 ; then + echo "ldapsearch failed at producer ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Using ldapsearch to read all the entries from the consumer..." +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \ + '(objectclass=*)' '*' $OPATTRS > $SLAVEOUT 2>&1 +RC=$? + +if test $RC != 0 ; then + echo "ldapsearch failed at consumer ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Filtering producer results..." +$LDIFFILTER < $MASTEROUT > $MASTERFLT +echo "Filtering consumer results..." +$LDIFFILTER < $SLAVEOUT > $SLAVEFLT + +echo "Comparing retrieved entries from producer and consumer..." +$CMP $MASTERFLT $SLAVEFLT > $CMPOUT + +if test $? != 0 ; then + echo "test failed - producer and consumer databases differ" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + echo "Stopping the provider, sleeping 10 seconds and restarting it..." kill -HUP "$PID" wait $PID @@ -203,10 +241,32 @@ drink: Coffee homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104 description: Very odd facsimiletelephonenumber: +1 313 555 7557 +facsimiletelephonenumber: +1 313 555 9998 +facsimiletelephonenumber: +1 313 555 9999 telephonenumber: +1 313 555 8343 mail: gjensen@mailgw.example.com homephone: +1 313 555 8844 +# modify attribute with no matching rule (ITS#6458) +dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com +changetype: modify +replace: facsimiletelephonenumber +facsimiletelephonenumber: +1 313 555 9998 +facsimiletelephonenumber: +1 313 555 9999 + +dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com +changetype: modify +replace: facsimiletelephonenumber +facsimiletelephonenumber: +1 313 555 9998 +facsimiletelephonenumber: +1 313 555 9999 +facsimiletelephonenumber: +1 313 555 7557 + +dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com +changetype: modify +replace: facsimiletelephonenumber +facsimiletelephonenumber: +1 313 555 9998 +facsimiletelephonenumber: +1 313 555 9999 + dn: ou=Retired, ou=People, dc=example,dc=com changetype: add objectclass: organizationalUnit @@ -267,6 +327,42 @@ fi echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." sleep $SLEEP1 +echo "Using ldapsearch to read all the entries from the producer..." +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ + '(objectclass=*)' '*' $OPATTRS > $MASTEROUT 2>&1 +RC=$? + +if test $RC != 0 ; then + echo "ldapsearch failed at producer ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Using ldapsearch to read all the entries from the consumer..." +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \ + '(objectclass=*)' '*' $OPATTRS > $SLAVEOUT 2>&1 +RC=$? + +if test $RC != 0 ; then + echo "ldapsearch failed at consumer ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Filtering producer results..." +$LDIFFILTER < $MASTEROUT > $MASTERFLT +echo "Filtering consumer results..." +$LDIFFILTER < $SLAVEOUT > $SLAVEFLT + +echo "Comparing retrieved entries from producer and consumer..." +$CMP $MASTERFLT $SLAVEFLT > $CMPOUT + +if test $? != 0 ; then + echo "test failed - producer and consumer databases differ" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + echo "Stopping consumer to test recovery..." kill -HUP $SLAVEPID wait $SLAVEPID @@ -316,6 +412,42 @@ KILLPIDS="$PID $SLAVEPID" echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." sleep $SLEEP1 +echo "Using ldapsearch to read all the entries from the producer..." +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ + '(objectclass=*)' '*' $OPATTRS > $MASTEROUT 2>&1 +RC=$? + +if test $RC != 0 ; then + echo "ldapsearch failed at producer ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Using ldapsearch to read all the entries from the consumer..." +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \ + '(objectclass=*)' '*' $OPATTRS > $SLAVEOUT 2>&1 +RC=$? + +if test $RC != 0 ; then + echo "ldapsearch failed at consumer ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Filtering producer results..." +$LDIFFILTER < $MASTEROUT > $MASTERFLT +echo "Filtering consumer results..." +$LDIFFILTER < $SLAVEOUT > $SLAVEFLT + +echo "Comparing retrieved entries from producer and consumer..." +$CMP $MASTERFLT $SLAVEFLT > $CMPOUT + +if test $? != 0 ; then + echo "test failed - producer and consumer databases differ" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 1 +fi + if test ! $BACKLDAP = "ldapno" ; then echo "Try updating the consumer slapd..." $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT4 -w $PASSWD > \ @@ -351,8 +483,6 @@ EOMODS sleep $SLEEP1 fi -OPATTRS="entryUUID creatorsName createTimestamp modifiersName modifyTimestamp" - echo "Using ldapsearch to read all the entries from the producer..." $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ '(objectclass=*)' '*' $OPATTRS > $MASTEROUT 2>&1 @@ -375,8 +505,6 @@ if test $RC != 0 ; then exit $RC fi -test $KILLSERVERS != no && kill -HUP $KILLPIDS - echo "Filtering producer results..." $LDIFFILTER < $MASTEROUT > $MASTERFLT echo "Filtering consumer results..." @@ -387,9 +515,12 @@ $CMP $MASTERFLT $SLAVEFLT > $CMPOUT if test $? != 0 ; then echo "test failed - producer and consumer databases differ" + test $KILLSERVERS != no && kill -HUP $KILLPIDS exit 1 fi +test $KILLSERVERS != no && kill -HUP $KILLPIDS + echo ">>>>> Test succeeded" test $KILLSERVERS != no && wait -- 2.39.5