5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh $*
11 echo "running defines.sh"
12 . $SRCDIR/scripts/defines.sh
14 echo "test020-syncreplication-cascading is temporarily disabled"
21 # - populate over ldap
22 # - perform some modifies and deleted
23 # - retrieve database over ldap and compare against expected results
26 echo "Cleaning up in $DBDIR..."
28 echo "Resetting $R1REPLDIR..."
31 echo "Resetting $R2REPLDIR..."
34 echo "Resetting $P1REPLDIR..."
37 echo "Resetting $P2REPLDIR..."
40 echo "Resetting $P3REPLDIR..."
46 echo "Starting master slapd on TCP/IP port $PORT..."
47 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
48 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
50 if test $WAIT != 0 ; then
56 echo "Waiting 5 seconds to wait for master to start..."
59 echo "Using ldapsearch to check that master slapd is running..."
60 for i in 0 1 2 3 4 5; do
61 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
62 'objectclass=*' > /dev/null 2>&1
64 if test $RC = 0 ; then
67 echo "Waiting 5 seconds for slapd to start..."
71 echo "Using ldapadd to create the context prefix entry in the master..."
72 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
73 $LDIFORDEREDCP > /dev/null 2>&1
75 if test $RC != 0 ; then
76 echo "ldapadd failed ($RC)!"
83 echo "Starting R1 slave slapd on TCP/IP port $R1SLAVEPORT..."
84 . $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $R1REPLCONF
85 $SLAPD -f $R1REPLCONF -h $R1SLAVEURI -d $LVL $TIMING > $R1SLAVELOG 2>&1 &
87 if test $WAIT != 0 ; then
88 echo SLAVE R1 PID $R1SLAVEPID
93 echo "Using ldapsearch to check that R1 slave slapd is running..."
94 for i in 0 1 2 3 4 5; do
95 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R1SLAVEPORT \
96 'objectclass=*' > /dev/null 2>&1
98 if test $RC = 0 ; then
101 echo "Waiting 5 seconds for R1 slapd to start..."
105 echo "Waiting for the R1 slave to replicate..."
108 echo "Starting R2 slave slapd on TCP/IP port $R2SLAVEPORT..."
109 . $CONFFILTER $BACKEND $MONITORDB < $R2SRSLAVECONF > $R2REPLCONF
110 $SLAPD -f $R2REPLCONF -h $R2SLAVEURI -d $LVL $TIMING > $R2SLAVELOG 2>&1 &
112 if test $WAIT != 0 ; then
113 echo SLAVE R2 PID $R2SLAVEPID
117 echo "Using ldapsearch to check that the R2 slave slapd is running..."
118 for i in 0 1 2 3 4 5; do
119 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $R2SLAVEPORT \
120 'objectclass=*' > /dev/null 2>&1
122 if test $RC = 0 ; then
125 echo "Waiting 5 seconds for R2 slave slapd to start..."
129 echo "Waiting for the R2 slave to replicate..."
134 echo "Starting P1 slave slapd on TCP/IP port $P1SLAVEPORT..."
135 . $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
136 $SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
138 if test $WAIT != 0 ; then
139 echo SLAVE P1 PID $P1SLAVEPID
144 echo "Using ldapsearch to check that the P1 slave slapd is running..."
145 for i in 0 1 2 3 4 5; do
146 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P1SLAVEPORT \
147 'objectclass=*' > /dev/null 2>&1
149 if test $RC = 0 ; then
152 echo "Waiting 5 seconds for P1 slave slapd to start..."
156 echo "Waiting for the P1 slave to replicate..."
159 echo "Starting P2 slave slapd on TCP/IP port $P2SLAVEPORT..."
160 . $CONFFILTER $BACKEND $MONITORDB < $P2SRSLAVECONF > $P2REPLCONF
161 $SLAPD -f $P2REPLCONF -h $P2SLAVEURI -d $LVL $TIMING > $P2SLAVELOG 2>&1 &
163 if test $WAIT != 0 ; then
164 echo SLAVE P2 PID $P2SLAVEPID
168 echo "Using ldapsearch to check that the P2 slave slapd is running..."
169 for i in 0 1 2 3 4 5; do
170 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P2SLAVEPORT \
171 'objectclass=*' > /dev/null 2>&1
173 if test $RC = 0 ; then
176 echo "Waiting 5 seconds for P2 slave slapd to start..."
180 echo "Starting P3 slave slapd on TCP/IP port $P3SLAVEPORT..."
181 . $CONFFILTER $BACKEND $MONITORDB < $P3SRSLAVECONF > $P3REPLCONF
182 $SLAPD -f $P3REPLCONF -h $P3SLAVEURI -d $LVL $TIMING > $P3SLAVELOG 2>&1 &
184 if test $WAIT != 0 ; then
185 echo SLAVE P3 PID $P3SLAVEPID
189 echo "Using ldapsearch to check that the P3 slave slapd is running..."
190 for i in 0 1 2 3 4 5; do
191 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P3SLAVEPORT \
192 'objectclass=*' > /dev/null 2>&1
194 if test $RC = 0 ; then
197 echo "Waiting 5 seconds for P3 slave slapd to start..."
201 echo "Using ldapadd to populate the master directory..."
202 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
203 $LDIFORDEREDNOCP > /dev/null 2>&1
205 if test $RC != 0 ; then
206 echo "ldapadd failed ($RC)!"
207 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
211 echo "Waiting 60 seconds for syncrepl to receive changes..."
214 echo "Using ldapmodify to modify master directory..."
217 # Do some modifications
220 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
221 $TESTOUT 2>&1 << EOMODS
222 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
233 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
239 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
242 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
243 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
246 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
247 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
249 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
253 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
255 objectclass: OpenLDAPperson
259 title: Chief Investigator, ITD
260 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
261 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
263 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
264 description: Very odd
265 facsimiletelephonenumber: +1 313 555 7557
266 telephonenumber: +1 313 555 8343
267 mail: gjensen@mailgw.example.com
268 homephone: +1 313 555 8844
270 dn: ou=Retired, ou=People, o=University of Michigan, c=US
272 objectclass: organizationalUnit
275 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
277 objectclass: OpenLDAPperson
278 cn: Rosco P. Coltrane
282 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
284 newrdn: cn=Rosco P. Coltrane
286 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
288 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
293 echo "Waiting 60 seconds for syncrepl to receive changes..."
296 echo "Using ldapsearch to read all the entries from the master..."
297 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
298 'objectclass=*' > $MASTEROUT 2>&1
301 if test $RC != 0 ; then
302 echo "ldapsearch failed at master ($RC)!"
303 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
307 echo "Using ldapsearch to read all the entries from the R1 slave..."
308 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R1SLAVEPORT \
309 'objectclass=*' > $R1SLAVEOUT 2>&1
312 if test $RC != 0 ; then
313 echo "ldapsearch failed at R1 slave ($RC)!"
314 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
318 echo "Using ldapsearch to read all the entries from the R2 slave..."
319 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $R2SLAVEPORT \
320 'objectclass=*' > $R2SLAVEOUT 2>&1
323 if test $RC != 0 ; then
324 echo "ldapsearch failed at R2 slave ($RC)!"
325 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
329 echo "Using ldapsearch to read all the entries from the P1 slave..."
330 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P1SLAVEPORT \
331 'objectclass=*' > $P1SLAVEOUT 2>&1
334 if test $RC != 0 ; then
335 echo "ldapsearch failed at R1 slave ($RC)!"
336 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
340 echo "Using ldapsearch to read all the entries from the P2 slave..."
341 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P2SLAVEPORT \
342 'objectclass=*' > $P2SLAVEOUT 2>&1
345 if test $RC != 0 ; then
346 echo "ldapsearch failed at R2 slave ($RC)!"
347 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
351 echo "Using ldapsearch to read all the entries from the P3 slave..."
352 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P3SLAVEPORT \
353 'objectclass=*' > $P3SLAVEOUT 2>&1
356 if test $RC != 0 ; then
357 echo "ldapsearch failed at R2 slave ($RC)!"
358 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
362 kill -HUP $PID $R1SLAVEPID $R2SLAVEPID $P1SLAVEPID $P2SLAVEPID $P3SLAVEPID
371 echo "Filtering master ldapsearch results..."
372 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
373 echo "Filtering R1 slave ldapsearch results..."
374 . $LDIFFILTER < $R1LDIF > $R1LDIFFLT
375 echo "Filtering R2 slave ldapsearch results..."
376 . $LDIFFILTER < $R2LDIF > $R2LDIFFLT
377 echo "Filtering P1 slave ldapsearch results..."
378 . $LDIFFILTER < $P1LDIF > $P1LDIFFLT
379 echo "Filtering P2 slave ldapsearch results..."
380 . $LDIFFILTER < $P2LDIF > $P2LDIFFLT
381 echo "Filtering P3 slave ldapsearch results..."
382 . $LDIFFILTER < $P3LDIF > $P3LDIFFLT
384 echo "Comparing retrieved entries from master and R1 slave..."
385 $CMP $SEARCHFLT $R1LDIFFLT > $CMPOUT
387 if test $? != 0 ; then
388 echo "test failed - master and R1 slave databases differ"
392 echo "Comparing retrieved entries from master and R2 slave..."
393 $CMP $SEARCHFLT $R2LDIFFLT > $CMPOUT
395 if test $? != 0 ; then
396 echo "test failed - master and R2 slave databases differ"
400 echo "Comparing retrieved entries from master and P1 slave..."
401 $CMP $SEARCHFLT $P1LDIFFLT > $CMPOUT
403 if test $? != 0 ; then
404 echo "test failed - master and P1 slave databases differ"
408 echo "Comparing retrieved entries from master and P2 slave..."
409 $CMP $SEARCHFLT $P2LDIFFLT > $CMPOUT
411 if test $? != 0 ; then
412 echo "test failed - master and P2 slave databases differ"
416 echo "Comparing retrieved entries from master and P3 slave..."
417 $CMP $SEARCHFLT $P3LDIFFLT > $CMPOUT
419 if test $? != 0 ; then
420 echo "test failed - master and P3 slave databases differ"
424 echo ">>>>> Test succeeded"