From 40a632cdde9c0eb4803055e427e612c72ea6fdb7 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 21 Jun 2004 10:06:23 +0000 Subject: [PATCH] add test for rootdn; better check search results (not over yet)... --- tests/scripts/test025-limits | 266 +++++++++++++++++++++++++++-------- 1 file changed, 210 insertions(+), 56 deletions(-) diff --git a/tests/scripts/test025-limits b/tests/scripts/test025-limits index 6f7beaa70c..53fe1f90ad 100755 --- a/tests/scripts/test025-limits +++ b/tests/scripts/test025-limits @@ -88,6 +88,55 @@ case $RC in ;; esac +echo "Testing no limits requested for rootdn=$MANAGERDN..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret \ + -D "$MANAGERDN" \ + '(objectClass=*)' >$SEARCHOUT 2>&1 +RC=$? +COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` +case $RC in + 0) + echo "...success (got $COUNT entries)" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + +SIZELIMIT=4 +echo "Testing limit requested for rootdn=$MANAGERDN..." +$LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \ + -D "$MANAGERDN" \ + '(objectClass=*)' >$SEARCHOUT 2>&1 +RC=$? +COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` +case $RC in + 0) + if test x"$COUNT" != x ; then + if test "$COUNT" -gt "$SIZELIMIT" ; then + echo "...error: got $COUNT entries instead of the requested $SIZELIMIT" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + ;; + 4) + echo "...bumped into requested size limit ($SIZELIMIT)" + ;; + *) + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + SIZELIMIT=2 echo "Testing size limit request ($SIZELIMIT) for unlimited ID..." $LDAPRSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 -w secret -z $SIZELIMIT \ @@ -97,7 +146,18 @@ RC=$? COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` case $RC in 0) - echo "...success (got $COUNT entries)" + if test x"$COUNT" != x ; then + if test "$COUNT" -gt "$SIZELIMIT" ; then + echo "...error: got $COUNT entries instead of the requested $SIZELIMIT" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "...didn't bump into the requested size limit ($SIZELIMIT; got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 4) echo "...bumped into requested size limit ($SIZELIMIT)" @@ -118,10 +178,10 @@ RC=$? COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` case $RC in 0) - echo "...success (got $COUNT entries)" + echo "...didn't bump into the requested time limit ($TIMELIMIT s; got $COUNT entries)" ;; 3) - echo "...bumped into requested time limit ($TIMELIMIT s; $COUNT entries)" + echo "...bumped into requested time limit ($TIMELIMIT s; got $COUNT entries)" ;; *) echo "ldapsearch failed ($RC)!" @@ -138,10 +198,10 @@ RC=$? COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` case $RC in 0) - echo "...success; didn't bump into server-side size limit (got $COUNT entries)" + echo "...didn't bump into server-side size limit (got $COUNT entries)" ;; 4) - echo "...bumped into server-side size limit ($COUNT)" + echo "...bumped into server-side size limit (got $COUNT entries)" ;; *) echo "ldapsearch failed ($RC)!" @@ -159,7 +219,18 @@ 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)" + if test x"$COUNT" != x ; then + if test "$COUNT" -gt "$SIZELIMIT" ; then + echo "...error: got $COUNT entries instead of the requested $SIZELIMIT" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 4) if test "x$COUNT" != "x" ; then @@ -188,7 +259,18 @@ 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)" + if test x"$COUNT" != x ; then + if test "$COUNT" -gt "$SIZELIMIT" ; then + echo "...error: got $COUNT entries instead of the requested $SIZELIMIT" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 4) if test "x$COUNT" != "x" ; then @@ -217,7 +299,18 @@ 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)" + if test x"$COUNT" != x ; then + if test "$COUNT" -gt "$SIZELIMIT" ; then + echo "...error: got $COUNT entries instead of the requested $SIZELIMIT" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 4) echo "...bumped into requested ($SIZELIMIT) size limit" @@ -238,10 +331,23 @@ 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)" + if test x"$COUNT" != x ; then + if test "$COUNT" -gt "$SIZELIMIT" ; then + echo "...error: got $COUNT entries instead of the requested $SIZELIMIT" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi + echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 4) - echo "...bumped into requested ($SIZELIMIT) size limit" + echo "...error:bumped into requested ($SIZELIMIT) size limit" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC ;; 11) echo "...bumped into server-side hard size administrative limit" @@ -262,7 +368,13 @@ 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)" + if test x"$COUNT" != x ; then + echo "...didn't bump into either requested ($SIZELIMIT) or server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 4) echo "...bumped into requested ($SIZELIMIT=$COUNT) size limit" @@ -285,7 +397,13 @@ RC=$? COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` case $RC in 0) - echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" + if test x"$COUNT" != x ; then + echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 11) echo "...bumped into unchecked administrative limit" @@ -305,7 +423,13 @@ RC=$? COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` case $RC in 0) - echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" + if test x"$COUNT" != x ; then + echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + fi + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC ;; 11) echo "...bumped into unchecked administrative limit" @@ -325,7 +449,13 @@ RC=$? COUNT=`awk '/^# numEntries:/ {print $3}' $SEARCHOUT` case $RC in 0) - echo "...success; didn't bump into server-side unchecked limit (got $COUNT entries)" + if test x"$COUNT" != x ; then + echo "...error: didn't bump into server-side unchecked limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + fi + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC ;; 11) echo "...bumped into unchecked administrative limit" @@ -345,17 +475,21 @@ 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)" + if test x"$COUNT" != x ; then + echo "...didn't bump into server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 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 + echo "...bumped into server-side size limit ($COUNT)" else - echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + echo "...error: bumped into server-side size limit, but got 0 entries!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC fi ;; *) @@ -373,17 +507,21 @@ 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)" + if test x"$COUNT" != x ; then + echo "...didn't bump into server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 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 + echo "...bumped into server-side size limit ($COUNT)" else - echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + echo "...error: bumped into server-side size limit, but got 0 entries!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC fi ;; *) @@ -401,17 +539,21 @@ 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)" + if test x"$COUNT" != x ; then + echo "...didn't bump into server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 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 + echo "...bumped into server-side size limit ($COUNT)" else - echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + echo "...error: bumped into server-side size limit, but got 0 entries!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC fi ;; *) @@ -429,17 +571,21 @@ 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)" + if test x"$COUNT" != x ; then + echo "...didn't bump into server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 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 + echo "...bumped into server-side size limit ($COUNT)" else - echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + echo "...error: bumped into server-side size limit, but got 0 entries!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC fi ;; *) @@ -457,17 +603,21 @@ 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)" + if test x"$COUNT" != x ; then + echo "...didn't bump into server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 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 + echo "...bumped into server-side size limit ($COUNT)" else - echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + echo "...error: bumped into server-side size limit, but got 0 entries!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC fi ;; *) @@ -484,17 +634,21 @@ 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)" + if test x"$COUNT" != x ; then + echo "...didn't bump into server-side size limit (got $COUNT entries)" + else + echo "...error: did not expect ldapsearch success ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi ;; 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 + echo "...bumped into server-side size limit ($COUNT)" else - echo "...bumped into either requested ($SIZELIMIT) or server-side size limit" + echo "...error: bumped into server-side size limit, but got 0 entries!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC fi ;; *) -- 2.39.5