5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh $*
11 echo "running defines.sh"
12 . $SRCDIR/scripts/defines.sh
18 # - populate over ldap
19 # - perform some modifies and deleted
20 # - retrieve database over ldap and compare against expected results
23 echo "Cleaning up in $DBDIR..."
25 echo "Resetting $R1REPLDIR..."
28 echo "Resetting $R2REPLDIR..."
31 echo "Resetting $P1REPLDIR..."
34 echo "Resetting $P2REPLDIR..."
37 echo "Resetting $P3REPLDIR..."
43 echo "Starting master slapd on TCP/IP port $PORT..."
44 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
45 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
47 if test $WAIT != 0 ; then
53 echo "Waiting 5 seconds to wait for master to start..."
56 echo "Using ldapsearch to check that master slapd is running..."
57 for i in 0 1 2 3 4 5; do
58 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
59 'objectclass=*' > /dev/null 2>&1
61 if test $RC = 0 ; then
64 echo "Waiting 5 seconds for slapd to start..."
68 echo "Using ldapadd to create the context prefix entry in the master..."
69 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
70 $LDIFORDEREDCP > /dev/null 2>&1
72 if test $RC != 0 ; then
73 echo "ldapadd failed ($RC)!"
80 echo "Starting R1 slave slapd on TCP/IP port $R1SLAVEPORT..."
81 . $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
82 $SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
84 if test $WAIT != 0 ; then
85 echo SLAVE R1 PID $R1SLAVEPID
90 echo "Using ldapsearch to check that R1 slave slapd is running..."
91 for i in 0 1 2 3 4 5; do
92 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R1SLAVEPORT \
93 'objectclass=*' > /dev/null 2>&1
95 if test $RC = 0 ; then
98 echo "Waiting 5 seconds for R1 slapd to start..."
102 echo "Waiting for the R1 slave to replicate..."
105 echo "Starting R2 slave slapd on TCP/IP port $R2SLAVEPORT..."
106 . $CONFFILTER $BACKEND $MONITORDB < $R2SRSLAVECONF > $R2REPLCONF
107 $SLAPD -f $R2REPLCONF -h $R2SLAVEURI -d $LVL $TIMING > $R2SLAVELOG 2>&1 &
109 if test $WAIT != 0 ; then
110 echo SLAVE R2 PID $R2SLAVEPID
114 echo "Using ldapsearch to check that the R2 slave slapd is running..."
115 for i in 0 1 2 3 4 5; do
116 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R2SLAVEPORT \
117 'objectclass=*' > /dev/null 2>&1
119 if test $RC = 0 ; then
122 echo "Waiting 5 seconds for R2 slave slapd to start..."
126 echo "Waiting for the R2 slave to replicate..."
131 echo "Starting P1 slave slapd on TCP/IP port $P1SLAVEPORT..."
132 . $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
133 $SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
135 if test $WAIT != 0 ; then
136 echo SLAVE P1 PID $P1SLAVEPID
141 echo "Using ldapsearch to check that the P1 slave slapd is running..."
142 for i in 0 1 2 3 4 5; do
143 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P1SLAVEPORT \
144 'objectclass=*' > /dev/null 2>&1
146 if test $RC = 0 ; then
149 echo "Waiting 5 seconds for P1 slave slapd to start..."
153 echo "Waiting for the P1 slave to replicate..."
156 echo "Starting P2 slave slapd on TCP/IP port $P2SLAVEPORT..."
157 . $CONFFILTER $BACKEND $MONITORDB < $P2SRSLAVECONF > $P2REPLCONF
158 $SLAPD -f $P2REPLCONF -h $P2SLAVEURI -d $LVL $TIMING > $P2SLAVELOG 2>&1 &
160 if test $WAIT != 0 ; then
161 echo SLAVE P2 PID $P2SLAVEPID
165 echo "Using ldapsearch to check that the P2 slave slapd is running..."
166 for i in 0 1 2 3 4 5; do
167 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P2SLAVEPORT \
168 'objectclass=*' > /dev/null 2>&1
170 if test $RC = 0 ; then
173 echo "Waiting 5 seconds for P2 slave slapd to start..."
177 echo "Starting P3 slave slapd on TCP/IP port $P3SLAVEPORT..."
178 . $CONFFILTER $BACKEND $MONITORDB < $P3SRSLAVECONF > $P3REPLCONF
179 $SLAPD -f $P3REPLCONF -h $P3SLAVEURI -d $LVL $TIMING > $P3SLAVELOG 2>&1 &
181 if test $WAIT != 0 ; then
182 echo SLAVE P3 PID $P3SLAVEPID
186 echo "Using ldapsearch to check that the P3 slave slapd is running..."
187 for i in 0 1 2 3 4 5; do
188 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P3SLAVEPORT \
189 'objectclass=*' > /dev/null 2>&1
191 if test $RC = 0 ; then
194 echo "Waiting 5 seconds for P3 slave slapd to start..."
198 echo "Using ldapadd to populate the master directory..."
199 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
200 $LDIFORDEREDNOCP > /dev/null 2>&1
202 if test $RC != 0 ; then
203 echo "ldapadd failed ($RC)!"
204 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
208 echo "Waiting 30 seconds for syncrepl to receive changes..."
211 echo "Using ldapmodify to modify master directory..."
214 # Do some modifications
217 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
218 $TESTOUT 2>&1 << EOMODS
219 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
230 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
236 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
239 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
240 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
243 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
244 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
246 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
250 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
252 objectclass: OpenLDAPperson
256 title: Chief Investigator, ITD
257 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
258 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
260 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
261 description: Very odd
262 facsimiletelephonenumber: +1 313 555 7557
263 telephonenumber: +1 313 555 8343
264 mail: gjensen@mailgw.example.com
265 homephone: +1 313 555 8844
267 dn: ou=Retired, ou=People, o=University of Michigan, c=US
269 objectclass: organizationalUnit
272 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
274 objectclass: OpenLDAPperson
275 cn: Rosco P. Coltrane
279 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
281 newrdn: cn=Rosco P. Coltrane
283 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
285 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
290 echo "Waiting 30 seconds for syncrepl to receive changes..."
293 echo "Using ldapsearch to read all the entries from the master..."
294 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
295 'objectclass=*' > $MASTEROUT 2>&1
298 if test $RC != 0 ; then
299 echo "ldapsearch failed at master ($RC)!"
300 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
304 echo "Using ldapsearch to read all the entries from the R1 slave..."
305 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R1SLAVEPORT \
306 'objectclass=*' > $R1SLAVEOUT 2>&1
309 if test $RC != 0 ; then
310 echo "ldapsearch failed at R1 slave ($RC)!"
311 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
315 echo "Using ldapsearch to read all the entries from the R2 slave..."
316 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R2SLAVEPORT \
317 'objectclass=*' > $R2SLAVEOUT 2>&1
320 if test $RC != 0 ; then
321 echo "ldapsearch failed at R2 slave ($RC)!"
322 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
326 echo "Using ldapsearch to read all the entries from the P1 slave..."
327 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P1SLAVEPORT \
328 'objectclass=*' > $P1SLAVEOUT 2>&1
331 if test $RC != 0 ; then
332 echo "ldapsearch failed at R1 slave ($RC)!"
333 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
337 echo "Using ldapsearch to read all the entries from the P2 slave..."
338 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P2SLAVEPORT \
339 'objectclass=*' > $P2SLAVEOUT 2>&1
342 if test $RC != 0 ; then
343 echo "ldapsearch failed at R2 slave ($RC)!"
344 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
348 echo "Using ldapsearch to read all the entries from the P3 slave..."
349 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P3SLAVEPORT \
350 'objectclass=*' > $P3SLAVEOUT 2>&1
353 if test $RC != 0 ; then
354 echo "ldapsearch failed at R2 slave ($RC)!"
355 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
359 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
368 echo "Filtering master ldapsearch results..."
369 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
370 echo "Filtering R1 slave ldapsearch results..."
371 . $LDIFFILTER < $R1LDIF > $R1LDIFFLT
372 echo "Filtering R2 slave ldapsearch results..."
373 . $LDIFFILTER < $R2LDIF > $R2LDIFFLT
374 echo "Filtering P1 slave ldapsearch results..."
375 . $LDIFFILTER < $P1LDIF > $P1LDIFFLT
376 echo "Filtering P2 slave ldapsearch results..."
377 . $LDIFFILTER < $P2LDIF > $P2LDIFFLT
378 echo "Filtering P3 slave ldapsearch results..."
379 . $LDIFFILTER < $P3LDIF > $P3LDIFFLT
381 echo "Comparing retrieved entries from master and R1 slave..."
382 $CMP $SEARCHFLT $R1LDIFFLT > $CMPOUT
384 if test $? != 0 ; then
385 echo "test failed - master and R1 slave databases differ"
389 echo "Comparing retrieved entries from master and R2 slave..."
390 $CMP $SEARCHFLT $R2LDIFFLT > $CMPOUT
392 if test $? != 0 ; then
393 echo "test failed - master and R2 slave databases differ"
397 echo "Comparing retrieved entries from master and P1 slave..."
398 $CMP $SEARCHFLT $P1LDIFFLT > $CMPOUT
400 if test $? != 0 ; then
401 echo "test failed - master and P1 slave databases differ"
405 echo "Comparing retrieved entries from master and P2 slave..."
406 $CMP $SEARCHFLT $P2LDIFFLT > $CMPOUT
408 if test $? != 0 ; then
409 echo "test failed - master and P2 slave databases differ"
413 echo "Comparing retrieved entries from master and P3 slave..."
414 $CMP $SEARCHFLT $P3LDIFFLT > $CMPOUT
416 if test $? != 0 ; then
417 echo "test failed - master and P3 slave databases differ"
421 echo ">>>>> Test succeeded"