4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
7 mkdir $TESTDIR $DBDIR1 $DBDIR2 $DBDIR3 $DBDIR4 $DBDIR5 $DBDIR6
13 # - populate over ldap
14 # - perform some modifies and deleted
15 # - retrieve database over ldap and compare against expected results
18 echo "Starting master slapd on TCP/IP port $PORT1..."
19 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
20 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
22 if test $WAIT != 0 ; then
28 echo "Using ldapsearch to check that master slapd (pid=$PID) is running..."
29 for i in 0 1 2 3 4 5; do
30 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
31 'objectclass=*' > /dev/null 2>&1
33 if test $RC = 0 ; then
36 echo "Waiting 5 seconds for slapd to start..."
40 if test $RC != 0 ; then
41 echo "ldapsearch failed ($RC)!"
42 test $KILLSERVERS != no && kill -HUP $KILLPIDS
46 echo "Using ldapadd to create the context prefix entry in the master..."
47 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
48 $LDIFORDEREDCP > /dev/null 2>&1
50 if test $RC != 0 ; then
51 echo "ldapadd failed ($RC)!"
52 test $KILLSERVERS != no && kill -HUP $KILLPIDS
56 echo "Starting R1 slave slapd on TCP/IP port $PORT2..."
57 . $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $CONF2
58 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
60 if test $WAIT != 0 ; then
61 echo SLAVE R1 PID $SLAVEPID
64 KILLPIDS="$KILLPIDS $SLAVEPID"
66 echo "Using ldapsearch to check that R1 slave slapd(pid=$SLAVEPID) is running..."
67 for i in 0 1 2 3 4 5; do
68 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
69 'objectclass=*' > /dev/null 2>&1
71 if test $RC = 0 ; then
74 echo "Waiting 5 seconds for R1 slapd to start..."
78 if test $RC != 0 ; then
79 echo "ldapsearch failed ($RC)!"
80 test $KILLSERVERS != no && kill -HUP $KILLPIDS
84 echo "Starting R2 slave slapd on TCP/IP port $PORT3..."
85 . $CONFFILTER $BACKEND $MONITORDB < $R2SRSLAVECONF > $CONF3
86 $SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
88 if test $WAIT != 0 ; then
89 echo SLAVE R2 PID $SLAVEPID
92 KILLPIDS="$KILLPIDS $SLAVEPID"
94 echo "Using ldapsearch to check that R2 slave slapd(pid=$SLAVEPID) is running..."
95 for i in 0 1 2 3 4 5; do
96 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
97 'objectclass=*' > /dev/null 2>&1
99 if test $RC = 0 ; then
102 echo "Waiting 5 seconds for R2 slave slapd to start..."
106 if test $RC != 0 ; then
107 echo "ldapsearch failed ($RC)!"
108 test $KILLSERVERS != no && kill -HUP $KILLPIDS
112 echo "Starting P1 slave slapd on TCP/IP port $PORT4..."
113 . $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $CONF4
114 $SLAPD -f $CONF4 -h $URI4 -d $LVL $TIMING > $LOG4 2>&1 &
116 if test $WAIT != 0 ; then
117 echo SLAVE P1 PID $SLAVEPID
120 KILLPIDS="$KILLPIDS $SLAVEPID"
122 echo "Using ldapsearch to check that P1 slave slapd(pid=$SLAVEPID) is running..."
123 for i in 0 1 2 3 4 5; do
124 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT4 \
125 'objectclass=*' > /dev/null 2>&1
127 if test $RC = 0 ; then
130 echo "Waiting 5 seconds for P1 slave slapd to start..."
134 if test $RC != 0 ; then
135 echo "ldapsearch failed ($RC)!"
136 test $KILLSERVERS != no && kill -HUP $KILLPIDS
140 echo "Starting P2 slave slapd on TCP/IP port $PORT5..."
141 . $CONFFILTER $BACKEND $MONITORDB < $P2SRSLAVECONF > $CONF5
142 $SLAPD -f $CONF5 -h $URI5 -d $LVL $TIMING > $LOG5 2>&1 &
144 if test $WAIT != 0 ; then
145 echo SLAVE P2 PID $SLAVEPID
148 KILLPIDS="$KILLPIDS $SLAVEPID"
150 echo "Using ldapsearch to check that P2 slave slapd(pid=$SLAVEPID) is running..."
151 for i in 0 1 2 3 4 5; do
152 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT5 \
153 'objectclass=*' > /dev/null 2>&1
155 if test $RC = 0 ; then
158 echo "Waiting 5 seconds for P2 slave slapd to start..."
162 if test $RC != 0 ; then
163 echo "ldapsearch failed ($RC)!"
164 test $KILLSERVERS != no && kill -HUP $KILLPIDS
168 echo "Starting P3 slave slapd on TCP/IP port $PORT6..."
169 . $CONFFILTER $BACKEND $MONITORDB < $P3SRSLAVECONF > $CONF6
170 $SLAPD -f $CONF6 -h $URI6 -d $LVL $TIMING > $LOG6 2>&1 &
172 if test $WAIT != 0 ; then
173 echo SLAVE P3 PID $SLAVEPID
176 KILLPIDS="$KILLPIDS $SLAVEPID"
178 echo "Using ldapsearch to check that P3 slave slapd(pid=$SLAVEPID) is running..."
179 for i in 0 1 2 3 4 5; do
180 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT6 \
181 'objectclass=*' > /dev/null 2>&1
183 if test $RC = 0 ; then
186 echo "Waiting 5 seconds for P3 slave slapd to start..."
190 if test $RC != 0 ; then
191 echo "ldapsearch failed ($RC)!"
192 test $KILLSERVERS != no && kill -HUP $KILLPIDS
196 echo "Using ldapadd to populate the master directory..."
197 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
198 $LDIFORDEREDNOCP > /dev/null 2>&1
200 if test $RC != 0 ; then
201 echo "ldapadd failed ($RC)!"
202 test $KILLSERVERS != no && kill -HUP $KILLPIDS
206 echo "Waiting 25 seconds for syncrepl to receive changes..."
209 echo "Using ldapmodify to modify master directory..."
212 # Do some modifications
215 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
216 $TESTOUT 2>&1 << EOMODS
217 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
228 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
234 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
237 uniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
238 uniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
241 uniquemember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
242 uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
244 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
248 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
250 objectclass: OpenLDAPperson
254 title: Chief Investigator, ITD
255 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
256 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
258 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
259 description: Very odd
260 facsimiletelephonenumber: +1 313 555 7557
261 telephonenumber: +1 313 555 8343
262 mail: gjensen@mailgw.example.com
263 homephone: +1 313 555 8844
265 dn: ou=Retired, ou=People, o=University of Michigan, c=US
267 objectclass: organizationalUnit
270 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
272 objectclass: OpenLDAPperson
273 cn: Rosco P. Coltrane
277 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
279 newrdn: cn=Rosco P. Coltrane
281 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
283 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
289 if test $RC != 0 ; then
290 echo "ldapmodify failed ($RC)!"
291 test $KILLSERVERS != no && kill -HUP $KILLPIDS
295 echo "Waiting 25 seconds for syncrepl to receive changes..."
298 echo "Using ldapsearch to read all the entries from the master..."
299 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
300 'objectclass=*' > $MASTEROUT 2>&1
303 if test $RC != 0 ; then
304 echo "ldapsearch failed at master ($RC)!"
305 test $KILLSERVERS != no && kill -HUP $KILLPIDS
309 echo "Using ldapsearch to read all the entries from the R1 slave..."
310 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
311 'objectclass=*' > $SERVER2OUT 2>&1
314 if test $RC != 0 ; then
315 echo "ldapsearch failed at R1 slave ($RC)!"
316 test $KILLSERVERS != no && kill -HUP $KILLPIDS
320 echo "Using ldapsearch to read all the entries from the R2 slave..."
321 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT3 \
322 'objectclass=*' > $SERVER3OUT 2>&1
325 if test $RC != 0 ; then
326 echo "ldapsearch failed at R2 slave ($RC)!"
327 test $KILLSERVERS != no && kill -HUP $KILLPIDS
331 echo "Using ldapsearch to read all the entries from the P1 slave..."
332 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \
333 'objectclass=*' > $SERVER4OUT 2>&1
336 if test $RC != 0 ; then
337 echo "ldapsearch failed at P1 slave ($RC)!"
338 test $KILLSERVERS != no && kill -HUP $KILLPIDS
342 echo "Using ldapsearch to read all the entries from the P2 slave..."
343 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT5 \
344 'objectclass=*' > $SERVER5OUT 2>&1
347 if test $RC != 0 ; then
348 echo "ldapsearch failed at P2 slave ($RC)!"
349 test $KILLSERVERS != no && kill -HUP $KILLPIDS
353 echo "Using ldapsearch to read all the entries from the P3 slave..."
354 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT6 \
355 'objectclass=*' > $SERVER6OUT 2>&1
358 if test $RC != 0 ; then
359 echo "ldapsearch failed at P3 slave ($RC)!"
360 test $KILLSERVERS != no && kill -HUP $KILLPIDS
364 test $KILLSERVERS != no && kill -HUP $KILLPIDS
366 echo "Filtering master ldapsearch results..."
367 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
368 echo "Filtering R1 slave ldapsearch results..."
369 . $LDIFFILTER < $SERVER2OUT > $SERVER2FLT
370 echo "Filtering R2 slave ldapsearch results..."
371 . $LDIFFILTER < $SERVER3OUT > $SERVER3FLT
372 echo "Filtering P1 slave ldapsearch results..."
373 . $LDIFFILTER < $SERVER4OUT > $SERVER4FLT
374 echo "Filtering P2 slave ldapsearch results..."
375 . $LDIFFILTER < $SERVER5OUT > $SERVER5FLT
376 echo "Filtering P3 slave ldapsearch results..."
377 . $LDIFFILTER < $SERVER6OUT > $SERVER6FLT
379 echo "Comparing retrieved entries from master and R1 slave..."
380 $CMP $MASTERFLT $SERVER2FLT > $CMPOUT
382 if test $? != 0 ; then
383 echo "test failed - master and R1 slave databases differ"
387 echo "Comparing retrieved entries from master and R2 slave..."
388 $CMP $MASTERFLT $SERVER3FLT > $CMPOUT
390 if test $? != 0 ; then
391 echo "test failed - master and R2 slave databases differ"
395 echo "Comparing retrieved entries from master and P1 slave..."
396 $CMP $MASTERFLT $SERVER4FLT > $CMPOUT
398 if test $? != 0 ; then
399 echo "test failed - master and P1 slave databases differ"
403 echo "Comparing retrieved entries from master and P2 slave..."
404 $CMP $MASTERFLT $SERVER5FLT > $CMPOUT
406 if test $? != 0 ; then
407 echo "test failed - master and P2 slave databases differ"
411 echo "Comparing retrieved entries from master and P3 slave..."
412 $CMP $MASTERFLT $SERVER6FLT > $CMPOUT
414 if test $? != 0 ; then
415 echo "test failed - master and P3 slave databases differ"
419 echo ">>>>> Test succeeded"