8 if test $# -ge 1 ; then
12 . $SRCDIR/scripts/args.sh $*
14 if test "$BACKEND" != "ldbm"; then
15 echo "Test only valid for back-ldbm"
19 echo "running defines.sh"
20 . $SRCDIR/scripts/defines.sh
26 # - perform first set of searches at the proxy
27 # - verify cacheability
28 # - perform second set of searches at the proxy
29 # - verify answerability
31 #if test ! -x $SLAPD ; then
32 # echo ">>>>> $SLAPD is not executable or does not exist."
33 # echo ">>>>> Test skipped."
42 if test ! -d $CACHEDIR
47 echo "Cleaning up in $DBDIR..."
49 echo "Cleaning up in $CACHEDIR..."
50 rm -rf $CACHEDIR/[!C]*
53 echo "Starting master slapd on TCP/IP port $PORT..."
54 . $CONFFILTER < $CACHEMASTERCONF > $DBCONF
55 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL > $MASTERLOG 2>&1 &
57 if test $WAIT != 0 ; then
64 echo "Using ldapadd to populate the master directory..."
65 $LDAPADD -x -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
66 $LDIFORDERED > /dev/null 2>&1
68 if test $RC != 0 ; then
69 echo "ldapadd failed ($RC)!"
74 echo "Starting proxy cache on TCP/IP port $SLAVEPORT..."
75 . $CONFFILTER < $PROXYCACHECONF > $CACHECONF
76 $SLAPD -f $CACHECONF -h $SLAVEURI -d $LVL > $SLAVELOG 2>&1 &
79 if test $WAIT != 0 ; then
80 echo CACHEPID $CACHEPID
85 echo "Making queries on the proxy cache..."
86 echo "Query 1: filter:(sn=Jon) attrs: all"
87 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
88 'sn=Jon' > $SLAVEOUT 2>&1
90 if test $RC != 0 ; then
91 echo "ldapsearch failed ($RC)!"
92 kill -HUP $PID $CACHEPID
97 echo "Query 2: filter:(|(cn=*Jon*)(sn=Jon*)) attrs:cn sn title"
98 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
99 '(|(cn=*Jon*)(sn=Jon*))' cn sn title >> $SLAVEOUT 2>&1
101 if test $RC != 0 ; then
102 echo "ldapsearch failed ($RC)!"
103 kill -HUP $PID $CACHEPID
108 echo "Query 3: filter:(sn=Smith*) attrs:cn sn title"
109 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
110 'sn=Smith*' cn sn title >> $SLAVEOUT 2>&1
112 if test $RC != 0 ; then
113 echo "ldapsearch failed ($RC)!"
114 kill -HUP $PID $CACHEPID
119 echo "Query 4: filter:(sn=Doe*) attrs:cn sn title"
120 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
121 'sn=Doe' cn sn title >> $SLAVEOUT 2>&1
123 if test $RC != 0 ; then
124 echo "ldapsearch failed ($RC)!"
125 kill -HUP $PID $CACHEPID
130 echo "Query 5: filter:(uid=bjorn) attrs:mail postaladdress telephonenumber"
131 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
132 'uid=bjorn' mail postaladdress telephonenumber >> $SLAVEOUT 2>&1
134 if test $RC != 0 ; then
135 echo "ldapsearch failed ($RC)!"
136 kill -HUP $PID $CACHEPID
141 echo "Query 6: filter:(mail=*@example.com) cn sn title"
142 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
143 'mail=*@mail.alumni.example.com' cn sn title >> $SLAVEOUT 2>&1
145 if test $RC != 0 ; then
146 echo "ldapsearch failed ($RC)!"
147 kill -HUP $PID $CACHEPID
152 echo "Query 7: filter:(mail=*) cn sn title"
153 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
154 'mail=*' cn sn title >> $SLAVEOUT 2>&1
156 if test $RC != 0 ; then
157 echo "ldapsearch failed ($RC)!"
158 kill -HUP $PID $CACHEPID
162 # queries 2-6 are cacheable
164 grep CACHEABLE $SLAVELOG | awk '{
166 printf "Query %d not cacheable\n",NR
168 printf "Query %d cacheable\n",NR
170 CACHED=`grep CACHEABLE $SLAVELOG | awk '{
177 if test $CACHEABILITY = $CACHED
179 echo "successfully verified cacheability"
181 echo "error in verifying cacheability"
182 kill -HUP $PID $CACHEPID
186 echo "Query 8: filter:(|(cn=*Jones)(sn=Jones)) attrs:cn sn title"
187 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
188 '(|(cn=*Jones)(sn=Jones))' cn sn title >> $SLAVEOUT 2>&1
190 if test $RC != 0 ; then
191 echo "ldapsearch failed ($RC)!"
192 kill -HUP $PID $CACHEPID
197 echo "Query 9: filter:(sn=Smith) attrs:cn sn title"
198 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
199 'sn=Smith' cn sn title >> $SLAVEOUT 2>&1
201 if test $RC != 0 ; then
202 echo "ldapsearch failed ($RC)!"
203 kill -HUP $PID $CACHEPID
208 echo "Query 10: filter:(uid=bjorn) attrs:mail postaladdress telephonenumber"
209 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
210 'uid=bjorn' mail postaladdress telephonenumber >> $SLAVEOUT 2>&1
212 if test $RC != 0 ; then
213 echo "ldapsearch failed ($RC)!"
214 kill -HUP $PID $CACHEPID
219 echo "Query 11: filter:(mail=*@example.com) cn sn title"
220 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
221 'mail=jaj@mail.alumni.example.com' cn sn title >> $SLAVEOUT 2>&1
223 if test $RC != 0 ; then
224 echo "ldapsearch failed ($RC)!"
225 kill -HUP $PID $CACHEPID
229 #queries 8-11 are answerable
231 grep ANSWERABLE $SLAVELOG | awk '{
234 printf "Query %d not answerable\n",NR
236 printf "Query %d answerable\n",NR
239 ANSWERED=`grep ANSWERABLE $SLAVELOG | awk '{
247 if test $ANSWERABILITY = $ANSWERED
249 echo "successfully verified answerability"
251 echo "error in verifying answerability"
252 kill -HUP $PID $CACHEPID
256 echo "Proxy cache successfully tested"
257 kill -HUP $PID $CACHEPID