From 45523220c99ca3c0f299de38703dcdc5b6ef5f56 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 19 Jun 2004 10:04:49 +0000 Subject: [PATCH] add test for max size limit --- tests/scripts/test025-limits | 82 ++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/tests/scripts/test025-limits b/tests/scripts/test025-limits index 1329f81d93..6f7beaa70c 100755 --- a/tests/scripts/test025-limits +++ b/tests/scripts/test025-limits @@ -13,6 +13,8 @@ ## top-level directory of the distribution or, alternatively, at ## . +## FIXME: need to exclude legal but wrong results... + echo "running defines.sh" . $SRCDIR/scripts/defines.sh @@ -251,6 +253,30 @@ case $RC in ;; esac +SIZELIMIT=max +echo "Testing max limit request ($SIZELIMIT) for hard limited ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \ + -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \ + '(objectClass=*)' > $SEARCHOUT 2>&1 +RC=$? +COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` +case $RC in + 0) + echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + ;; + 4) + echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit" + ;; + 11) + echo "...bumped into server-side hard size administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + echo "Testing lower than unchecked limit request for unchecked limited ID..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \ @@ -677,6 +703,30 @@ case $RC in ;; esac +SIZELIMIT=max +echo "Testing max limit request ($SIZELIMIT) for hard limited ID..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \ + -D 'cn=Hard Limited User,ou=People,dc=example,dc=com' \ + -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1 +RC=$? +COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` +case $RC in + 0) + echo "...success; didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + ;; + 4) + echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit" + ;; + 11) + echo "...bumped into hard size administrative limit" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + echo "Testing lower than unchecked limit request for unchecked limited ID..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ -D 'cn=Unchecked Limited User,ou=People,dc=example,dc=com' \ @@ -874,6 +924,38 @@ case $RC in ;; esac +SIZELIMIT=max +echo "Testing max 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,dc=example,dc=com' \ + -z $SIZELIMIT -E '!pr='$PAGESIZE'/noprompt' '(objectClass=*)' > $SEARCHOUT 2>&1 +RC=$? +COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` +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 "x$SIZELIMIT" = "x$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 echo ">>>>> Test succeeded" -- 2.39.5