From f7aa0221db79415c1679eb6423769fa66553da92 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sun, 18 Apr 2004 21:04:45 +0000 Subject: [PATCH] more pagedResults tests --- tests/data/slapd-limits.conf | 5 + tests/data/test-limits.ldif | 32 ++++++ tests/scripts/test025-limits | 188 +++++++++++++++++++++++++++++++---- 3 files changed, 207 insertions(+), 18 deletions(-) diff --git a/tests/data/slapd-limits.conf b/tests/data/slapd-limits.conf index 9be0262b89..a21b39f6b8 100644 --- a/tests/data/slapd-limits.conf +++ b/tests/data/slapd-limits.conf @@ -40,6 +40,11 @@ rootpw secret #bdb#index objectClass eq #bdb#index uid eq +#bdb#limits dn.exact="cn=Unlimited User,ou=Paged Results Users,o=University of Michigan,c=US" size=4 size.pr=none +#bdb#limits dn.exact="cn=Page Size Limited User,ou=Paged Results Users,o=University of Michigan,c=US" size=4 size.pr=4 +#bdb#limits dn.exact="cn=Paged Results Disabled User,ou=Paged Results Users,o=University of Michigan,c=US" size=4 size.prtotal=disabled +#bdb#limits dn.exact="cn=Paged Results Limited User,ou=Paged Results Users,o=University of Michigan,c=US" size=4 size.prtotal=10 + limits dn.exact="cn=Unlimited User,ou=People,o=University of Michigan,c=US" size=none time=none limits dn.exact="cn=Soft Limited User,ou=People,o=University of Michigan,c=US" size.soft=4 size.hard=none limits dn.exact="cn=Hard Limited User,ou=People,o=University of Michigan,c=US" size.soft=4 size.hard=8 diff --git a/tests/data/test-limits.ldif b/tests/data/test-limits.ldif index feacebbb59..330e2273ed 100644 --- a/tests/data/test-limits.ldif +++ b/tests/data/test-limits.ldif @@ -105,3 +105,35 @@ sn: User uid: special userpassword:: c2VjcmV0 +dn: ou=Paged Results Users,o=University of Michigan,c=US +objectclass: organizationalUnit +ou: Paged Results Users + +dn: cn=Unlimited User,ou=Paged Results Users,o=University of Michigan,c=US +objectclass: OpenLDAPperson +cn: Unlimited User +sn: User +uid: unlimited +userpassword:: c2VjcmV0 + +dn: cn=Page Size Limited User,ou=Paged Results Users,o=University of Michigan,c=US +objectclass: OpenLDAPperson +cn: Page Size Limited User +sn: User +uid: pagesizelimited +userpassword:: c2VjcmV0 + +dn: cn=Paged Results Disabled User,ou=Paged Results Users,o=University of Michigan,c=US +objectclass: OpenLDAPperson +cn: Paged Results Disabled User +sn: User +uid: pagedresultsdisabled +userpassword:: c2VjcmV0 + +dn: cn=Paged Results Limited User,ou=Paged Results Users,o=University of Michigan,c=US +objectclass: OpenLDAPperson +cn: Paged Results Limited User +sn: User +uid: pagedresultslimited +userpassword:: c2VjcmV0 + diff --git a/tests/scripts/test025-limits b/tests/scripts/test025-limits index abfdd2bac6..607cab5bd1 100755 --- a/tests/scripts/test025-limits +++ b/tests/scripts/test025-limits @@ -242,7 +242,7 @@ case $RC in echo "...bumped into requested ($SIZELIMIT) size limit" ;; 11) - echo "...bumped into server-side size limit" + echo "...bumped into server-side hard size administrative limit" ;; *) echo "ldapsearch failed ($RC)!" @@ -262,7 +262,7 @@ case $RC in echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" ;; 11) - echo "...bumped into server-side unchecked limit" + echo "...bumped into unchecked administrative limit" ;; *) echo "ldapsearch failed ($RC)!" @@ -282,7 +282,7 @@ case $RC in echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" ;; 11) - echo "...bumped into server-side unchecked limit" + echo "...bumped into unchecked administrative limit" ;; *) echo "ldapsearch failed ($RC)!" @@ -291,7 +291,7 @@ case $RC in ;; esac -echo "Testing higher than unchecked limit requested for unchecked limited group..." +echo "Testing no limits requested for unchecked limited group..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Unchecked Limited User 2,ou=People,o=University of Michigan,c=US' \ '(objectClass=*)' > $SEARCHOUT 2>&1 @@ -302,7 +302,7 @@ case $RC in echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" ;; 11) - echo "...bumped into server-side unchecked limit" + echo "...bumped into unchecked administrative limit" ;; *) echo "ldapsearch failed ($RC)!" @@ -311,7 +311,7 @@ case $RC in ;; esac -echo "Testing higher than unchecked limit requested for unchecked limited regex..." +echo "Testing no limits requested for limited regex..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Foo User,ou=People,o=University of Michigan,c=US' \ '(objectClass=*)' > $SEARCHOUT 2>&1 @@ -339,7 +339,7 @@ case $RC in ;; esac -echo "Testing higher than unchecked limit requested for unchecked limited onelevel..." +echo "Testing no limits requested for limited onelevel..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Bar User,ou=People,o=University of Michigan,c=US' \ '(objectClass=*)' > $SEARCHOUT 2>&1 @@ -367,7 +367,7 @@ case $RC in ;; esac -echo "Testing higher than unchecked limit requested for unchecked limited children..." +echo "Testing no limit requested for limited children..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Unchecked Limited Users,ou=Groups,o=University of Michigan,c=US' \ '(objectClass=*)' > $SEARCHOUT 2>&1 @@ -395,7 +395,7 @@ case $RC in ;; esac -echo "Testing higher than unchecked limit requested for unchecked limited subtree..." +echo "Testing no limit requested for limited subtree..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Unchecked Limited User 3,ou=Admin,o=University of Michigan,c=US' \ '(objectClass=*)' > $SEARCHOUT 2>&1 @@ -423,7 +423,7 @@ case $RC in ;; esac -echo "Testing higher than unchecked limit requested for unchecked limited users..." +echo "Testing no limit requested for limited users..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Special User,o=University of Michigan,c=US' \ '(objectClass=*)' > $SEARCHOUT 2>&1 @@ -451,7 +451,7 @@ case $RC in ;; esac -echo "Testing higher than unchecked limit requested for unchecked limited anonymous..." +echo "Testing no limit requested for limited anonymous..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \ '(objectClass=*)' > $SEARCHOUT 2>&1 RC=$? @@ -668,7 +668,7 @@ case $RC in echo "...bumped into requested ($SIZELIMIT) size limit" ;; 11) - echo "...bumped into server-side size limit" + echo "...bumped into hard size administrative limit" ;; *) echo "ldapsearch failed ($RC)!" @@ -688,7 +688,7 @@ case $RC in echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" ;; 11) - echo "...bumped into server-side unchecked limit" + echo "...bumped into unchecked administrative limit" ;; *) echo "ldapsearch failed ($RC)!" @@ -708,7 +708,7 @@ case $RC in echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" ;; 11) - echo "...bumped into server-side unchecked limit" + echo "...bumped into unchecked administrative limit" ;; *) echo "ldapsearch failed ($RC)!" @@ -717,10 +717,162 @@ case $RC in ;; esac -# TODO -#echo "" -#echo "Testing specific search limits with pagedResults control" -#echo "" +echo "" +echo "Testing specific search limits with pagedResults control" +echo "" + +echo "Testing no limit requested for unlimited page size ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ + -D 'cn=Unlimited User,ou=Paged Results Users,o=University of Michigan,c=US' \ + -E '!pr='$PAGESIZE '(objectClass=*)' $SEARCHOUT 2>&1 +RC=$? +COUNT=`cat $SEARCHOUT | grep '^# numEntries:' | sed 's;[^0-9]\+\([0-9]\+\)$;\1;'` +case $RC in + 0) + echo "...success; didn't bump into server-side size limit (got $COUNT entries)" + ;; + 4) + echo "...bumped into server-side size limit ($COUNT)" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + +echo "Testing no limit requested for limited page size ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ + -D 'cn=Page Size Limited User,ou=Paged Results Users,o=University of Michigan,c=US' \ + -E '!pr='$PAGESIZE '(objectClass=*)' $SEARCHOUT 2>&1 +RC=$? +COUNT=`cat $SEARCHOUT | grep '^# numEntries:' | sed 's;[^0-9]\+\([0-9]\+\)$;\1;'` +case $RC in + 0) + echo "...success; didn't bump into server-side page size limit (got $COUNT entries)" + ;; + 4) + echo "...bumped into page size limit ($COUNT)" + ;; + 11) + echo "...bumped into page size administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + +echo "Testing no limit requested for pagedResults disabled ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ + -D 'cn=Paged Results Disabled User,ou=Paged Results Users,o=University of Michigan,c=US' \ + -E '!pr='$PAGESIZE '(objectClass=*)' $SEARCHOUT 2>&1 +RC=$? +COUNT=`cat $SEARCHOUT | grep '^# numEntries:' | sed 's;[^0-9]\+\([0-9]\+\)$;\1;'` +case $RC in + 0) + echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" + ;; + 4) + echo "...bumped into server-side size limit ($COUNT)" + ;; + 11) + echo "...bumped into pagedResults disabled administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + +echo "Testing no limit requested for pagedResults total count limited ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ + -D 'cn=Paged Results Limited User,ou=Paged Results Users,o=University of Michigan,c=US' \ + -E '!pr='$PAGESIZE '(objectClass=*)' $SEARCHOUT 2>&1 +RC=$? +COUNT=`cat $SEARCHOUT | grep '^# numEntries:' | sed 's;[^0-9]\+\([0-9]\+\)$;\1;'` +case $RC in + 0) + echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" + ;; + 4) + echo "...bumped into server-side size limit ($COUNT)" + ;; + 11) + echo "...bumped into pagedResults total count administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + +SIZELIMIT=8 +echo "Testing higher than hard but lower then total count limit requested for pagedResults total count limited ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ + -D 'cn=Paged Results Limited User,ou=Paged Results Users,o=University of Michigan,c=US' \ + -z $SIZELIMIT -E '!pr='$PAGESIZE '(objectClass=*)' $SEARCHOUT 2>&1 +RC=$? +COUNT=`cat $SEARCHOUT | grep '^# numEntries:' | sed 's;[^0-9]\+\([0-9]\+\)$;\1;'` +case $RC in + 0) + echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)" + ;; + 4) + if test "x$COUNT" != "x" ; then + if test $SIZELIMIT = $COUNT ; then + echo "...bumped into requested ($SIZELIMIT) size limit" + else + echo "...bumped into server-side size limit ($COUNT)" + fi + else + echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + fi + ;; + 11) + echo "...bumped into either hard size or pagedResults total count administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + +SIZELIMIT=15 +echo "Testing higher than total count limit requested for pagedResults total count limited ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ + -D 'cn=Paged Results Limited User,ou=Paged Results Users,o=University of Michigan,c=US' \ + -z $SIZELIMIT -E '!pr='$PAGESIZE '(objectClass=*)' $SEARCHOUT 2>&1 +RC=$? +COUNT=`cat $SEARCHOUT | grep '^# numEntries:' | sed 's;[^0-9]\+\([0-9]\+\)$;\1;'` +case $RC in + 0) + echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side unchecked limit (got $COUNT entries)" + ;; + 4) + if test "x$COUNT" != "x" ; then + if test $SIZELIMIT = $COUNT ; then + echo "...bumped into requested ($SIZELIMIT) size limit" + else + echo "...bumped into server-side size limit ($COUNT)" + fi + else + echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + fi + ;; + 11) + echo "...bumped into pagedResults total count administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac test $KILLSERVERS != no && kill -HUP $KILLPIDS -- 2.39.5