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 uniqueMember: cn=James A Jones 2, ou=Information Technology Division,
120 ou=People, o=University of Michigan, c=US
121 uniqueMember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
124 uniqueMember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
125 uniqueMember: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
127 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
131 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
133 objectclass: OpenLDAPperson
137 title: Chief Investigator, ITD
138 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
139 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
141 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
142 description: Very odd
143 facsimiletelephonenumber: +1 313 555 7557
144 telephonenumber: +1 313 555 8343
145 mail: gjensen@mailgw.example.com
146 homephone: +1 313 555 8844
148 dn: ou=Retired, ou=People, o=University of Michigan, c=US
150 objectclass: organizationalUnit
153 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
155 objectclass: OpenLDAPperson
156 cn: Rosco P. Coltrane
160 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
162 newrdn: cn=Rosco P. Coltrane
164 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
166 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
172 if test $RC != 0 ; then
173 echo "ldapmodify failed ($RC)!"
174 test $KILLSERVERS != no && kill -HUP $KILLPIDS
178 echo "Waiting 15 seconds for slurpd to send changes..."
181 echo "Using ldapsearch to read all the entries from the master..."
182 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
183 'objectclass=*' > $MASTEROUT 2>&1
186 if test $RC != 0 ; then
187 echo "ldapsearch failed ($RC)!"
188 test $KILLSERVERS != no && kill -HUP $KILLPIDS
192 echo "Using ldapsearch to read all the entries from the slave..."
193 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
194 'objectclass=*' > $SLAVEOUT 2>&1
197 if test $RC != 0 ; then
198 echo "ldapsearch failed ($RC)!"
199 test $KILLSERVERS != no && kill -HUP $KILLPIDS
203 test $KILLSERVERS != no && kill -HUP $KILLPIDS
205 echo "Filtering master results..."
206 . $LDIFFILTER < $MASTEROUT > $MASTERFLT
207 echo "Filtering slave results..."
208 . $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
210 echo "Comparing retrieved entries from master and slave..."
211 $CMP $MASTERFLT $SLAVEFLT > $CMPOUT
213 if test $? != 0 ; then
214 echo "test failed - master and slave databases differ"
218 echo ">>>>> Test succeeded"