4 echo "running defines.sh"
5 . $SRCDIR/scripts/defines.sh
7 if test ! -x $SLURPD ; then
8 echo ">>>>> $SLURPD is not executable or do not exist."
9 echo ">>>>> Test skipped."
13 mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR2
17 # - start master (slapd1)
18 # - start slave (slapd2)
20 # - populate over ldap
21 # - perform some modifies and deleted
22 # - retrieve database over ldap and compare against expected results
25 echo "Starting master slapd on TCP/IP port $PORT1..."
26 . $CONFFILTER $BACKEND $MONITORDB < $MASTERCONF > $CONF1
27 $SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
29 if test $WAIT != 0 ; then
35 echo "Starting slave slapd on TCP/IP port $PORT2..."
36 . $CONFFILTER $BACKEND $MONITORDB < $SLAVECONF > $CONF2
37 $SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
39 if test $WAIT != 0 ; then
40 echo SLAVEPID $SLAVEPID
43 KILLPIDS="$KILLPIDS $SLAVEPID"
45 echo "Using ldapsearch to check that master slapd is running..."
46 for i in 0 1 2 3 4 5; do
47 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
48 'objectclass=*' > /dev/null 2>&1
50 if test $RC = 0 ; then
53 echo "Waiting 5 seconds for slapd to start..."
57 echo "Using ldapsearch to check that slave slapd is running..."
58 for i in 0 1 2 3 4 5; do
59 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
60 'objectclass=*' > /dev/null 2>&1
62 if test $RC = 0 ; then
65 echo "Waiting 5 seconds for slapd to start..."
69 echo "Starting slurpd..."
70 $SLURPD -f $CONF1 -d ${SLURPD_DEBUG-5} -t $DBDIR1B > $SLURPLOG 2>&1 &
72 if test $WAIT != 0 ; then
73 echo SLURPPID $SLURPPID
76 KILLPIDS="$KILLPIDS $SLURPPID"
78 echo "Using ldapadd to populate the master directory..."
79 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
80 $LDIFORDERED > /dev/null 2>&1
82 if test $RC != 0 ; then
83 echo "ldapadd failed ($RC)!"
84 test $KILLSERVERS != no && kill -HUP $KILLPIDS
88 echo "Waiting 15 seconds for slurpd to send changes..."
91 echo "Using ldapmodify to modify master directory..."
94 # Do some modifications
97 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
98 $TESTOUT 2>&1 << EOMODS
99 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
110 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
116 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
119 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
120 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
123 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
124 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
126 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
130 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
132 objectclass: OpenLDAPperson
136 title: Chief Investigator, ITD
137 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
138 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
140 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
141 description: Very odd
142 facsimiletelephonenumber: +1 313 555 7557
143 telephonenumber: +1 313 555 8343
144 mail: gjensen@mailgw.example.com
145 homephone: +1 313 555 8844
147 dn: ou=Retired, ou=People, o=University of Michigan, c=US
149 objectclass: organizationalUnit
152 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
154 objectclass: OpenLDAPperson
155 cn: Rosco P. Coltrane
159 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
161 newrdn: cn=Rosco P. Coltrane
163 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
165 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
170 if test $RC != 0 ; then
171 echo "ldapmodify failed ($RC)!"
172 test $KILLSERVERS != no && kill -HUP $KILLPIDS
176 echo "Waiting 15 seconds for slurpd to send changes..."
179 echo "Using ldapsearch to read all the entries from the master..."
180 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
181 'objectclass=*' > $MASTEROUT 2>&1
184 if test $RC != 0 ; then
185 echo "ldapsearch failed ($RC)!"
186 test $KILLSERVERS != no && kill -HUP $KILLPIDS
190 echo "Using ldapsearch to read all the entries from the slave..."
191 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
192 'objectclass=*' > $SLAVEOUT 2>&1
195 if test $RC != 0 ; then
196 echo "ldapsearch failed ($RC)!"
197 test $KILLSERVERS != no && kill -HUP $KILLPIDS
201 test $KILLSERVERS != no && kill -HUP $KILLPIDS
203 echo "Filtering master results..."
204 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
205 echo "Filtering slave results..."
206 . $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
208 echo "Comparing retrieved entries from master and slave..."
209 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
211 if test $? != 0 ; then
212 echo "test failed - master and slave databases differ"
216 echo ">>>>> Test succeeded"