5 if test $# -ge 1 ; then
9 . $SRCDIR/scripts/args.sh $*
11 echo "test018-syncreplication-persist is temporarily disabled"
14 echo "running defines.sh"
15 . $SRCDIR/scripts/defines.sh
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 $P1REPLDIR..."
34 echo "Starting master slapd on TCP/IP port $PORT..."
35 . $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $DBCONF
36 $SLAPD -f $DBCONF -h $MASTERURI -d $LVL $TIMING > $MASTERLOG 2>&1 &
38 if test $WAIT != 0 ; then
44 echo "Waiting 5 seconds to wait for master to start..."
47 echo "Using ldapsearch to check that master slapd is running..."
48 for i in 0 1 2 3 4 5; do
49 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT \
50 'objectclass=*' > /dev/null 2>&1
52 if test $RC = 0 ; then
55 echo "Waiting 5 seconds for slapd to start..."
59 echo "Using ldapadd to create the context prefix entry in the master..."
60 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
61 $LDIFORDEREDCP > /dev/null 2>&1
63 if test $RC != 0 ; then
64 echo "ldapadd failed ($RC)!"
65 kill -HUP $PID $SLAVEPID
69 echo "Starting slave slapd on TCP/IP port $P1SLAVEPORT..."
70 . $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $P1REPLCONF
71 $SLAPD -f $P1REPLCONF -h $P1SLAVEURI -d $LVL $TIMING > $P1SLAVELOG 2>&1 &
73 if test $WAIT != 0 ; then
74 echo SLAVEPID $P1SLAVEPID
78 echo "Using ldapsearch to check that slave slapd is running..."
79 for i in 0 1 2 3 4 5; do
80 $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $P1SLAVEPORT \
81 'objectclass=*' > /dev/null 2>&1
83 if test $RC = 0 ; then
86 echo "Waiting 5 seconds for slapd to start..."
90 echo "Using ldapadd to populate the master directory..."
91 $LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD < \
92 $LDIFORDEREDNOCP > /dev/null 2>&1
94 if test $RC != 0 ; then
95 echo "ldapadd failed ($RC)!"
96 kill -HUP $PID $SLAVEPID
100 echo "Waiting 20 seconds for syncrepl to receive changes..."
103 echo "Using ldapmodify to modify master directory..."
106 # Do some modifications
109 $LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT -w $PASSWD > \
110 $TESTOUT 2>&1 << EOMODS
111 dn: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
122 dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
128 dn: cn=ITD Staff,ou=Groups,o=University of Michigan,c=US
131 member: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
132 member: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
135 member: cn=Dorothy Stevens, ou=Alumni Association, ou=People, o=University of Michigan, c=US
136 member: cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US
138 dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
142 dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
144 objectclass: OpenLDAPperson
148 title: Chief Investigator, ITD
149 postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
150 seealso: cn=All Staff, ou=Groups, o=University of Michigan, c=US
152 homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
153 description: Very odd
154 facsimiletelephonenumber: +1 313 555 7557
155 telephonenumber: +1 313 555 8343
156 mail: gjensen@mailgw.example.com
157 homephone: +1 313 555 8844
159 dn: ou=Retired, ou=People, o=University of Michigan, c=US
161 objectclass: organizationalUnit
164 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
166 objectclass: OpenLDAPperson
167 cn: Rosco P. Coltrane
171 dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
173 newrdn: cn=Rosco P. Coltrane
175 newsuperior: ou=Retired, ou=People, o=University of Michigan, c=US
177 dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, o=University of Michigan, c=US
182 echo "Waiting 20 seconds for syncrepl to receive changes..."
185 echo "Using ldapsearch to read all the entries from the master..."
186 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT \
187 'objectclass=*' > $MASTEROUT 2>&1
190 if test $RC != 0 ; then
191 echo "ldapsearch failed at master ($RC)!"
192 kill -HUP $PID $SLAVEPID
196 echo "Using ldapsearch to read all the entries from the slave..."
197 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $P1SLAVEPORT \
198 'objectclass=*' > $P1SLAVEOUT 2>&1
201 if test $RC != 0 ; then
202 echo "ldapsearch failed at slave ($RC)!"
203 kill -HUP $PID $P1SLAVEPID
207 kill -HUP $PID $P1SLAVEPID
212 echo "Filtering ldapsearch results..."
213 . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
214 echo "Filtering original ldif used to create database..."
215 . $LDIFFILTER < $LDIF > $P1LDIFFLT
217 echo "Comparing retrieved entries from master and slave..."
218 $CMP $SEARCHFLT $P1LDIFFLT > $CMPOUT
220 if test $? != 0 ; then
221 echo "test failed - master and slave databases differ"
225 echo ">>>>> Test succeeded"