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 90 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 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
238 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
241 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
242 member: 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
288 echo "Waiting 90 seconds for syncrepl to receive changes..."
291 echo "Using ldapsearch to read all the entries from the master..."
292 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
293 'objectclass=*' > $MASTEROUT 2>&1
296 if test $RC != 0 ; then
297 echo "ldapsearch failed at master ($RC)!"
298 test $KILLSERVERS != no && kill -HUP $KILLPIDS
302 echo "Using ldapsearch to read all the entries from the R1 slave..."
303 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
304 'objectclass=*' > $SERVER2OUT 2>&1
307 if test $RC != 0 ; then
308 echo "ldapsearch failed at R1 slave ($RC)!"
309 test $KILLSERVERS != no && kill -HUP $KILLPIDS
313 echo "Using ldapsearch to read all the entries from the R2 slave..."
314 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT3 \
315 'objectclass=*' > $SERVER3OUT 2>&1
318 if test $RC != 0 ; then
319 echo "ldapsearch failed at R2 slave ($RC)!"
320 test $KILLSERVERS != no && kill -HUP $KILLPIDS
324 echo "Using ldapsearch to read all the entries from the P1 slave..."
325 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \
326 'objectclass=*' > $SERVER4OUT 2>&1
329 if test $RC != 0 ; then
330 echo "ldapsearch failed at P1 slave ($RC)!"
331 test $KILLSERVERS != no && kill -HUP $KILLPIDS
335 echo "Using ldapsearch to read all the entries from the P2 slave..."
336 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT5 \
337 'objectclass=*' > $SERVER5OUT 2>&1
340 if test $RC != 0 ; then
341 echo "ldapsearch failed at P2 slave ($RC)!"
342 test $KILLSERVERS != no && kill -HUP $KILLPIDS
346 echo "Using ldapsearch to read all the entries from the P3 slave..."
347 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT6 \
348 'objectclass=*' > $SERVER6OUT 2>&1
351 if test $RC != 0 ; then
352 echo "ldapsearch failed at P3 slave ($RC)!"
353 test $KILLSERVERS != no && kill -HUP $KILLPIDS
357 test $KILLSERVERS != no && kill -HUP $KILLPIDS
359 echo "Filtering master ldapsearch results..."
360 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
361 echo "Filtering R1 slave ldapsearch results..."
362 . $LDIFFILTER < $SERVER2OUT > $SERVER2FLT
363 echo "Filtering R2 slave ldapsearch results..."
364 . $LDIFFILTER < $SERVER3OUT > $SERVER3FLT
365 echo "Filtering P1 slave ldapsearch results..."
366 . $LDIFFILTER < $SERVER4OUT > $SERVER4FLT
367 echo "Filtering P2 slave ldapsearch results..."
368 . $LDIFFILTER < $SERVER5OUT > $SERVER5FLT
369 echo "Filtering P3 slave ldapsearch results..."
370 . $LDIFFILTER < $SERVER6OUT > $SERVER6FLT
372 echo "Comparing retrieved entries from master and R1 slave..."
373 $CMP $MASTERFLT $SERVER2FLT > $CMPOUT
375 if test $? != 0 ; then
376 echo "test failed - master and R1 slave databases differ"
380 echo "Comparing retrieved entries from master and R2 slave..."
381 $CMP $MASTERFLT $SERVER3FLT > $CMPOUT
383 if test $? != 0 ; then
384 echo "test failed - master and R2 slave databases differ"
388 echo "Comparing retrieved entries from master and P1 slave..."
389 $CMP $MASTERFLT $SERVER4FLT > $CMPOUT
391 if test $? != 0 ; then
392 echo "test failed - master and P1 slave databases differ"
396 echo "Comparing retrieved entries from master and P2 slave..."
397 $CMP $MASTERFLT $SERVER5FLT > $CMPOUT
399 if test $? != 0 ; then
400 echo "test failed - master and P2 slave databases differ"
404 echo "Comparing retrieved entries from master and P3 slave..."
405 $CMP $MASTERFLT $SERVER6FLT > $CMPOUT
407 if test $? != 0 ; then
408 echo "test failed - master and P3 slave databases differ"
412 echo ">>>>> Test succeeded"