8 if test $# -ge 1 ; then
12 . $SRCDIR/scripts/args.sh $*
14 if test $PROXYCACHE = no; then
15 echo "Proxy caching requires back-meta AND (back-ldbm OR back-bdb)"
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 &
78 if test $WAIT != 0 ; then
79 echo CACHEPID $CACHEPID
84 echo "Making queries on the proxy cache..."
85 echo "Query 1: filter:(sn=Jon) attrs: all"
86 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
87 'sn=Jon' > $SLAVEOUT 2>&1
89 if test $RC != 0 ; then
90 echo "ldapsearch failed ($RC)!"
91 kill -HUP $PID $CACHEPID
96 echo "Query 2: filter:(|(cn=*Jon*)(sn=Jon*)) attrs:cn sn title uid"
97 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
98 '(|(cn=*Jon*)(sn=Jon*))' cn sn title uid >> $SLAVEOUT 2>&1
100 if test $RC != 0 ; then
101 echo "ldapsearch failed ($RC)!"
102 kill -HUP $PID $CACHEPID
107 echo "Query 3: filter:(sn=Smith*) attrs:cn sn title uid"
108 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
109 'sn=Smith*' cn sn title uid >> $SLAVEOUT 2>&1
111 if test $RC != 0 ; then
112 echo "ldapsearch failed ($RC)!"
113 kill -HUP $PID $CACHEPID
118 echo "Query 4: filter:(sn=Doe*) attrs:cn sn title uid"
119 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
120 'sn=Doe' cn sn title uid >> $SLAVEOUT 2>&1
122 if test $RC != 0 ; then
123 echo "ldapsearch failed ($RC)!"
124 kill -HUP $PID $CACHEPID
129 echo "Query 5: filter:(uid=bjorn) attrs:mail postaladdress telephonenumber cn uid"
130 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
131 'uid=bjorn' mail postaladdress telephonenumber cn uid >> $SLAVEOUT 2>&1
133 if test $RC != 0 ; then
134 echo "ldapsearch failed ($RC)!"
135 kill -HUP $PID $CACHEPID
140 echo "Query 6: filter:(mail=*@example.com) cn sn title uid"
141 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
142 'mail=*@mail.alumni.example.com' cn sn title uid >> $SLAVEOUT 2>&1
144 if test $RC != 0 ; then
145 echo "ldapsearch failed ($RC)!"
146 kill -HUP $PID $CACHEPID
151 echo "Query 7: filter:(mail=*) cn sn title uid"
152 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
153 'mail=*' cn sn title uid >> $SLAVEOUT 2>&1
155 if test $RC != 0 ; then
156 echo "ldapsearch failed ($RC)!"
157 kill -HUP $PID $CACHEPID
161 # queries 2-6 are cacheable
163 grep CACHEABLE $SLAVELOG | awk '{
165 printf "Query %d not cacheable\n",NR
167 printf "Query %d cacheable\n",NR
169 CACHED=`grep CACHEABLE $SLAVELOG | awk '{
176 if test $CACHEABILITY = $CACHED
178 echo "successfully verified cacheability"
180 echo "error in verifying cacheability"
181 kill -HUP $PID $CACHEPID
185 echo "Query 8: filter:(|(cn=*Jones)(sn=Jones)) attrs:cn sn title uid"
186 $LDAPSEARCH -x -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
187 '(|(cn=*Jones)(sn=Jones))' cn sn title uid >> $SLAVEOUT 2>&1
189 if test $RC != 0 ; then
190 echo "ldapsearch failed ($RC)!"
191 kill -HUP $PID $CACHEPID
196 echo "Query 9: filter:(sn=Smith) attrs:cn sn title uid"
197 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
198 'sn=Smith' cn sn title uid >> $SLAVEOUT 2>&1
200 if test $RC != 0 ; then
201 echo "ldapsearch failed ($RC)!"
202 kill -HUP $PID $CACHEPID
207 echo "Query 10: filter:(uid=bjorn) attrs:mail postaladdress telephonenumber cn uid"
208 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
209 'uid=bjorn' mail postaladdress telephonenumber cn uid >> $SLAVEOUT 2>&1
211 if test $RC != 0 ; then
212 echo "ldapsearch failed ($RC)!"
213 kill -HUP $PID $CACHEPID
218 echo "Query 11: filter:(mail=*@example.com) cn sn title uid"
219 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $SLAVEPORT \
220 'mail=jaj@mail.alumni.example.com' cn sn title uid >> $SLAVEOUT 2>&1
222 if test $RC != 0 ; then
223 echo "ldapsearch failed ($RC)!"
224 kill -HUP $PID $CACHEPID
228 #queries 8-11 are answerable
230 grep ANSWERABLE $SLAVELOG | awk '{
233 printf "Query %d not answerable\n",NR
235 printf "Query %d answerable\n",NR
238 ANSWERED=`grep ANSWERABLE $SLAVELOG | awk '{
246 if test $ANSWERABILITY = $ANSWERED
248 echo "successfully verified answerability"
250 echo "error in verifying answerability"
251 kill -HUP $PID $CACHEPID
255 echo "Proxy cache successfully tested"
256 kill -HUP $PID $CACHEPID