7 if test $# -ge 1 ; then
11 . $SRCDIR/scripts/args.sh
13 echo "running defines.sh"
14 . $SRCDIR/scripts/defines.sh
22 # - perform first set of searches at the proxy
23 # - verify cacheability
24 # - perform second set of searches at the proxy
25 # - verify answerability
27 #if test ! -x $SLAPD ; then
28 # echo ">>>>> $SLAPD is not executable or does not exist."
29 # echo ">>>>> Test skipped."
38 if test ! -d $CACHEDIR
43 echo "Cleaning up in $DBDIR..."
45 echo "Cleaning up in $CACHEDIR..."
46 rm -rf $CACHEDIR/[!C]*
49 echo "Starting master slapd on TCP/IP port $PORT..."
50 . $CONFFILTER < $CACHEMASTERCONF > $DBCONF
51 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL > $MASTERLOG 2>&1 &
56 echo "Using ldapadd to populate the master directory..."
57 $LDAPADD -x -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
58 $LDIFORDERED > out 2>&1
60 if test $RC != 0 ; then
61 echo "ldapadd failed ($RC)!"
66 echo "Starting proxy cache on TCP/IP port $SLAVEPORT..."
67 . $CONFFILTER < $PROXYCACHECONF > $CACHECONF
68 $SLAPD -f $CACHECONF -h $SLAVEURI -d $LVL > $SLAVELOG 2>&1 &
72 echo "Making queries on the proxy cache..."
73 echo "Query 1: filter:(sn=Jon) attrs: all"
74 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
75 'sn=Jon' > $SLAVEOUT 2>&1
77 if test $RC != 0 ; then
78 echo "ldapsearch failed ($RC)!"
79 kill -HUP $PID $CACHEPID
84 echo "Query 2: filter:(|(cn=*Jon*)(sn=Jon*)) attrs:cn sn title"
85 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
86 '(|(cn=*Jon*)(sn=Jon*))' cn sn title >> $SLAVEOUT 2>&1
88 if test $RC != 0 ; then
89 echo "ldapsearch failed ($RC)!"
90 kill -HUP $PID $CACHEPID
95 echo "Query 3: filter:(sn=Smith*) attrs:cn sn title"
96 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
97 'sn=Smith*' cn sn title >> $SLAVEOUT 2>&1
99 if test $RC != 0 ; then
100 echo "ldapsearch failed ($RC)!"
101 kill -HUP $PID $CACHEPID
106 echo "Query 4: filter:(sn=Doe*) attrs:cn sn title"
107 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
108 'sn=Doe' cn sn title >> $SLAVEOUT 2>&1
110 if test $RC != 0 ; then
111 echo "ldapsearch failed ($RC)!"
112 kill -HUP $PID $CACHEPID
117 echo "Query 5: filter:(uid=bjorn) attrs:mail postaladdress telephonenumber"
118 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
119 'uid=bjorn' mail postaladdress telephonenumber >> $SLAVEOUT 2>&1
121 if test $RC != 0 ; then
122 echo "ldapsearch failed ($RC)!"
123 kill -HUP $PID $CACHEPID
128 echo "Query 6: filter:(mail=*@example.com) cn sn title"
129 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
130 'mail=*@mail.alumni.example.com' cn sn title >> $SLAVEOUT 2>&1
132 if test $RC != 0 ; then
133 echo "ldapsearch failed ($RC)!"
134 kill -HUP $PID $CACHEPID
139 echo "Query 7: filter:(mail=*) cn sn title"
140 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
141 'mail=*' cn sn title >> $SLAVEOUT 2>&1
143 if test $RC != 0 ; then
144 echo "ldapsearch failed ($RC)!"
145 kill -HUP $PID $CACHEPID
149 # queries 2-6 are cacheable
151 grep CACHEABLE $SLAVELOG | awk '{
153 printf "Query %d not cacheable\n",NR
155 printf "Query %d cacheable\n",NR
157 CACHED=`grep CACHEABLE $SLAVELOG | awk '{
164 if test $CACHEABILITY = $CACHED
166 echo "successfully verified cacheability"
168 echo "error in verifying cacheability"
169 kill -HUP $PID $CACHEPID
173 echo "Query 8: filter:(|(cn=*Jones)(sn=Jones)) attrs:cn sn title"
174 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
175 '(|(cn=*Jones)(sn=Jones))' cn sn title >> $SLAVEOUT 2>&1
177 if test $RC != 0 ; then
178 echo "ldapsearch failed ($RC)!"
179 kill -HUP $PID $CACHEPID
184 echo "Query 9: filter:(sn=Smith) attrs:cn sn title"
185 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
186 'sn=Smith' cn sn title >> $SLAVEOUT 2>&1
188 if test $RC != 0 ; then
189 echo "ldapsearch failed ($RC)!"
190 kill -HUP $PID $CACHEPID
195 echo "Query 10: filter:(uid=bjorn) attrs:mail postaladdress telephonenumber"
196 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
197 'uid=bjorn' mail postaladdress telephonenumber >> $SLAVEOUT 2>&1
199 if test $RC != 0 ; then
200 echo "ldapsearch failed ($RC)!"
201 kill -HUP $PID $CACHEPID
206 echo "Query 11: filter:(mail=*@example.com) cn sn title"
207 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
208 'mail=jaj@mail.alumni.example.com' cn sn title >> $SLAVEOUT 2>&1
210 if test $RC != 0 ; then
211 echo "ldapsearch failed ($RC)!"
212 kill -HUP $PID $CACHEPID
216 #queries 8-11 are answerable
218 grep ANSWERABLE $SLAVELOG | awk '{
221 printf "Query %d not answerable\n",NR
223 printf "Query %d answerable\n",NR
226 ANSWERED=`grep ANSWERABLE $SLAVELOG | awk '{
234 if test $ANSWERABILITY = $ANSWERED
236 echo "successfully verified answerability"
238 echo "error in verifying answerability"
239 kill -HUP $PID $CACHEPID
243 echo "Proxy cache successfully tested"
244 kill -HUP $PID $CACHEPID