From 58bf3de504c5b89464a6abc77ad170e04330493a Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 1 Jan 2011 19:49:27 +0000 Subject: [PATCH] add more rename/delete tests --- tests/data/memberof.out | 135 +++++++++++++++++++++++++++++---- tests/scripts/test052-memberof | 78 ++++++++++++++++--- 2 files changed, 188 insertions(+), 25 deletions(-) diff --git a/tests/data/memberof.out b/tests/data/memberof.out index 833df204af..32691bb33c 100644 --- a/tests/data/memberof.out +++ b/tests/data/memberof.out @@ -31,7 +31,7 @@ cn: Roger Rabbit sn: Rabbit memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com -# Re-search the entire database... +# Re-search the entire database after adding Jessica Rabbit and Cartoonia... dn: cn=Baby Herman,ou=People,dc=example,dc=com objectClass: inetOrgPerson cn: Baby Herman @@ -71,21 +71,19 @@ cn: Roger Rabbit sn: Rabbit memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com -# Re-search the entire database... -dn: cn=Baby Herman,ou=People,dc=example,dc=com +# Re-search the entire database after renaming Baby Herman... +dn: cn=Baby Herman Jr,ou=People,dc=example,dc=com objectClass: inetOrgPerson -cn: Baby Herman sn: Herman memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com +cn: Baby Herman Jr dn: cn=Cartoonia,ou=Groups,dc=example,dc=com objectClass: groupOfNames cn: Cartoonia member: cn=Roger Rabbit,ou=People,dc=example,dc=com -member: cn=Baby Herman,ou=People,dc=example,dc=com member: cn=Jessica Rabbit,ou=People,dc=example,dc=com -member: cn=Cartoonia,ou=Groups,dc=example,dc=com -memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com +member: cn=Baby Herman Jr,ou=People,dc=example,dc=com dn: dc=example,dc=com objectClass: organization @@ -113,14 +111,52 @@ cn: Roger Rabbit sn: Rabbit memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com -# Re-search the entire database... -dn: cn=Cartoonia,ou=Groups,dc=example,dc=com +# Re-search the entire database after renaming Cartoonia... +dn: cn=Baby Herman Jr,ou=People,dc=example,dc=com +objectClass: inetOrgPerson +sn: Herman +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com +cn: Baby Herman Jr + +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example, Inc. +dc: example + +dn: ou=Groups,dc=example,dc=com +objectClass: organizationalUnit +ou: Groups + +dn: cn=Jessica Rabbit,ou=People,dc=example,dc=com +objectClass: inetOrgPerson +cn: Jessica Rabbit +sn: Rabbit +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com + +dn: ou=People,dc=example,dc=com +objectClass: organizationalUnit +ou: People + +dn: cn=Roger Rabbit,ou=People,dc=example,dc=com +objectClass: inetOrgPerson +cn: Roger Rabbit +sn: Rabbit +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com + +dn: cn=Toon Town,ou=Groups,dc=example,dc=com objectClass: groupOfNames -cn: Cartoonia member: cn=Roger Rabbit,ou=People,dc=example,dc=com member: cn=Jessica Rabbit,ou=People,dc=example,dc=com -member: cn=Cartoonia,ou=Groups,dc=example,dc=com -memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com +member: cn=Baby Herman Jr,ou=People,dc=example,dc=com +cn: Toon Town + +# Re-search the entire database after adding Toon Town to self... +dn: cn=Baby Herman Jr,ou=People,dc=example,dc=com +objectClass: inetOrgPerson +sn: Herman +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com +cn: Baby Herman Jr dn: dc=example,dc=com objectClass: organization @@ -136,7 +172,77 @@ dn: cn=Jessica Rabbit,ou=People,dc=example,dc=com objectClass: inetOrgPerson cn: Jessica Rabbit sn: Rabbit -memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com + +dn: ou=People,dc=example,dc=com +objectClass: organizationalUnit +ou: People + +dn: cn=Roger Rabbit,ou=People,dc=example,dc=com +objectClass: inetOrgPerson +cn: Roger Rabbit +sn: Rabbit +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com + +dn: cn=Toon Town,ou=Groups,dc=example,dc=com +objectClass: groupOfNames +member: cn=Roger Rabbit,ou=People,dc=example,dc=com +member: cn=Jessica Rabbit,ou=People,dc=example,dc=com +member: cn=Baby Herman Jr,ou=People,dc=example,dc=com +member: cn=Toon Town,ou=Groups,dc=example,dc=com +cn: Toon Town +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com + +# Re-search the entire database after deleting Baby Herman... +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example, Inc. +dc: example + +dn: ou=Groups,dc=example,dc=com +objectClass: organizationalUnit +ou: Groups + +dn: cn=Jessica Rabbit,ou=People,dc=example,dc=com +objectClass: inetOrgPerson +cn: Jessica Rabbit +sn: Rabbit +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com + +dn: ou=People,dc=example,dc=com +objectClass: organizationalUnit +ou: People + +dn: cn=Roger Rabbit,ou=People,dc=example,dc=com +objectClass: inetOrgPerson +cn: Roger Rabbit +sn: Rabbit +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com + +dn: cn=Toon Town,ou=Groups,dc=example,dc=com +objectClass: groupOfNames +member: cn=Roger Rabbit,ou=People,dc=example,dc=com +member: cn=Jessica Rabbit,ou=People,dc=example,dc=com +member: cn=Toon Town,ou=Groups,dc=example,dc=com +cn: Toon Town +memberOf: cn=Toon Town,ou=Groups,dc=example,dc=com + +# Re-search the entire database after deleting Toon Town... +dn: dc=example,dc=com +objectClass: organization +objectClass: dcObject +o: Example, Inc. +dc: example + +dn: ou=Groups,dc=example,dc=com +objectClass: organizationalUnit +ou: Groups + +dn: cn=Jessica Rabbit,ou=People,dc=example,dc=com +objectClass: inetOrgPerson +cn: Jessica Rabbit +sn: Rabbit dn: ou=People,dc=example,dc=com objectClass: organizationalUnit @@ -146,9 +252,8 @@ dn: cn=Roger Rabbit,ou=People,dc=example,dc=com objectClass: inetOrgPerson cn: Roger Rabbit sn: Rabbit -memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com -# Re-search the entire database... +# Re-search the entire database after adding groups with MAY member type schemas... dn: dc=example,dc=com objectClass: organization objectClass: dcObject diff --git a/tests/scripts/test052-memberof b/tests/scripts/test052-memberof index a34facf9d7..777026e94a 100755 --- a/tests/scripts/test052-memberof +++ b/tests/scripts/test052-memberof @@ -221,7 +221,7 @@ member: cn=Jessica Rabbit,ou=People,$BASEDN EOF echo "Re-search the entire database..." -echo "# Re-search the entire database..." >> $SEARCHOUT +echo "# Re-search the entire database after adding Jessica Rabbit and Cartoonia..." >> $SEARCHOUT $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ '(objectClass=*)' '*' memberOf >> $SEARCHOUT 2>&1 RC=$? @@ -231,18 +231,60 @@ if test $RC != 0 ; then exit $RC fi -echo "Running ldapmodify to add self..." +echo "Running ldapmodify to rename a member..." +$LDAPMODIFY -h $LOCALHOST -p $PORT1 \ + -D "cn=Manager,$BASEDN" -w secret \ + >> $TESTOUT 2>&1 << EOF +dn: cn=Baby Herman,ou=People,$BASEDN +changetype: modrdn +newrdn: cn=Baby Herman Jr +deleteoldrdn: 1 +EOF + +echo "Re-search the entire database..." +echo "# Re-search the entire database after renaming Baby Herman..." >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ + '(objectClass=*)' '*' memberOf >> $SEARCHOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Running ldapmodify to rename a group..." $LDAPMODIFY -h $LOCALHOST -p $PORT1 \ -D "cn=Manager,$BASEDN" -w secret \ >> $TESTOUT 2>&1 << EOF dn: cn=Cartoonia,ou=Groups,$BASEDN +changetype: modrdn +newrdn: cn=Toon Town +deleteoldrdn: 1 +EOF + +echo "Re-search the entire database..." +echo "# Re-search the entire database after renaming Cartoonia..." >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ + '(objectClass=*)' '*' memberOf >> $SEARCHOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Running ldapmodify to add self..." +$LDAPMODIFY -h $LOCALHOST -p $PORT1 \ + -D "cn=Manager,$BASEDN" -w secret \ + >> $TESTOUT 2>&1 << EOF +dn: cn=Toon Town,ou=Groups,$BASEDN changetype: modify add: member -member: cn=Cartoonia,ou=Groups,$BASEDN +member: cn=Toon Town,ou=Groups,$BASEDN EOF echo "Re-search the entire database..." -echo "# Re-search the entire database..." >> $SEARCHOUT +echo "# Re-search the entire database after adding Toon Town to self..." >> $SEARCHOUT $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ '(objectClass=*)' '*' memberOf >> $SEARCHOUT 2>&1 RC=$? @@ -256,12 +298,31 @@ echo "Running ldapdelete to remove a member..." $LDAPMODIFY -h $LOCALHOST -p $PORT1 \ -D "cn=Manager,$BASEDN" -w secret \ >> $TESTOUT 2>&1 << EOF -dn: cn=Baby Herman,ou=People,$BASEDN +dn: cn=Baby Herman Jr,ou=People,$BASEDN +changetype: delete +EOF + +echo "Re-search the entire database..." +echo "# Re-search the entire database after deleting Baby Herman..." >> $SEARCHOUT +$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ + '(objectClass=*)' '*' memberOf >> $SEARCHOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Running ldapdelete to remove a group..." +$LDAPMODIFY -h $LOCALHOST -p $PORT1 \ + -D "cn=Manager,$BASEDN" -w secret \ + >> $TESTOUT 2>&1 << EOF +dn: cn=Toon Town,ou=Groups,$BASEDN changetype: delete EOF echo "Re-search the entire database..." -echo "# Re-search the entire database..." >> $SEARCHOUT +echo "# Re-search the entire database after deleting Toon Town..." >> $SEARCHOUT $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ '(objectClass=*)' '*' memberOf >> $SEARCHOUT 2>&1 RC=$? @@ -281,9 +342,6 @@ changetype: delete dn: cn=Jessica Rabbit,ou=People,$BASEDN changetype: delete -dn: cn=Cartoonia,ou=Groups,$BASEDN -changetype: delete - dn: cn=person1,ou=People,$BASEDN changetype: add objectClass: person @@ -321,7 +379,7 @@ delete: memberA EOF echo "Re-search the entire database..." -echo "# Re-search the entire database..." >> $SEARCHOUT +echo "# Re-search the entire database after adding groups with MAY member type schemas..." >> $SEARCHOUT $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ '(objectClass=*)' '*' memberOf >> $SEARCHOUT 2>&1 RC=$? -- 2.39.5