test078-persistent-sessionlog revision 1.1 1 1.1 christos #! /bin/sh
2 1.1 christos # $OpenLDAP$
3 1.1 christos ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 1.1 christos ##
5 1.1 christos ## Copyright 1998-2021 The OpenLDAP Foundation.
6 1.1 christos ## All rights reserved.
7 1.1 christos ##
8 1.1 christos ## Redistribution and use in source and binary forms, with or without
9 1.1 christos ## modification, are permitted only as authorized by the OpenLDAP
10 1.1 christos ## Public License.
11 1.1 christos ##
12 1.1 christos ## A copy of this license is available in the file LICENSE in the
13 1.1 christos ## top-level directory of the distribution or, alternatively, at
14 1.1 christos ## <http://www.OpenLDAP.org/license.html>.
15 1.1 christos
16 1.1 christos echo "running defines.sh"
17 1.1 christos . $SRCDIR/scripts/defines.sh
18 1.1 christos
19 1.1 christos if test $SYNCPROV = syncprovno; then
20 1.1 christos echo "Syncrepl provider overlay not available, test skipped"
21 1.1 christos exit 0
22 1.1 christos fi
23 1.1 christos if test $ACCESSLOG = accesslogno; then
24 1.1 christos echo "Accesslog overlay not available, test skipped"
25 1.1 christos exit 0
26 1.1 christos fi
27 1.1 christos
28 1.1 christos MMR=2
29 1.1 christos
30 1.1 christos XDIR=$TESTDIR/srv
31 1.1 christos TMP=$TESTDIR/tmp
32 1.1 christos
33 1.1 christos mkdir -p $TESTDIR
34 1.1 christos
35 1.1 christos $SLAPPASSWD -g -n >$CONFIGPWF
36 1.1 christos
37 1.1 christos if test x"$SYNCMODE" = x ; then
38 1.1 christos SYNCMODE=rp
39 1.1 christos fi
40 1.1 christos case "$SYNCMODE" in
41 1.1 christos ro)
42 1.1 christos SYNCTYPE="type=refreshOnly interval=00:00:00:03"
43 1.1 christos ;;
44 1.1 christos rp)
45 1.1 christos SYNCTYPE="type=refreshAndPersist interval=00:00:00:03"
46 1.1 christos ;;
47 1.1 christos *)
48 1.1 christos echo "unknown sync mode $SYNCMODE"
49 1.1 christos exit 1;
50 1.1 christos ;;
51 1.1 christos esac
52 1.1 christos
53 1.1 christos #
54 1.1 christos # Test delta-sync mmr
55 1.1 christos # - start servers
56 1.1 christos # - configure over ldap
57 1.1 christos # - populate over ldap
58 1.1 christos # - configure syncrepl over ldap
59 1.1 christos # - break replication
60 1.1 christos # - modify each server separately
61 1.1 christos # - restore replication
62 1.1 christos # - compare results
63 1.1 christos #
64 1.1 christos
65 1.1 christos nullExclude=""
66 1.1 christos test $BACKEND = null && nullExclude="# "
67 1.1 christos
68 1.1 christos KILLPIDS=
69 1.1 christos
70 1.1 christos echo "Initializing server configurations..."
71 1.1 christos n=1
72 1.1 christos while [ $n -le $MMR ]; do
73 1.1 christos
74 1.1 christos DBDIR=${XDIR}$n/db
75 1.1 christos CFDIR=${XDIR}$n/slapd.d
76 1.1 christos
77 1.1 christos mkdir -p ${XDIR}$n $DBDIR.1 $DBDIR.2 $CFDIR
78 1.1 christos
79 1.1 christos o=`expr 3 - $n`
80 1.1 christos cat > $TMP <<EOF
81 1.1 christos dn: cn=config
82 1.1 christos objectClass: olcGlobal
83 1.1 christos cn: config
84 1.1 christos olcServerID: $n
85 1.1 christos
86 1.1 christos EOF
87 1.1 christos
88 1.1 christos if [ "$SYNCPROV" = syncprovmod -o "$ACCESSLOG" = accesslogmod ]; then
89 1.1 christos cat <<EOF >> $TMP
90 1.1 christos dn: cn=module,cn=config
91 1.1 christos objectClass: olcModuleList
92 1.1 christos cn: module
93 1.1 christos olcModulePath: $TESTWD/../servers/slapd/overlays
94 1.1 christos EOF
95 1.1 christos if [ "$SYNCPROV" = syncprovmod ]; then
96 1.1 christos echo "olcModuleLoad: syncprov.la" >> $TMP
97 1.1 christos fi
98 1.1 christos if [ "$ACCESSLOG" = accesslogmod ]; then
99 1.1 christos echo "olcModuleLoad: accesslog.la" >> $TMP
100 1.1 christos fi
101 1.1 christos echo "" >> $TMP
102 1.1 christos fi
103 1.1 christos
104 1.1 christos if [ "$BACKENDTYPE" = mod ]; then
105 1.1 christos cat <<EOF >> $TMP
106 1.1 christos dn: cn=module,cn=config
107 1.1 christos objectClass: olcModuleList
108 1.1 christos cn: module
109 1.1 christos olcModulePath: $TESTWD/../servers/slapd/back-$BACKEND
110 1.1 christos olcModuleLoad: back_$BACKEND.la
111 1.1 christos
112 1.1 christos EOF
113 1.1 christos fi
114 1.1 christos MYURI=`eval echo '$URI'$n`
115 1.1 christos PROVIDERURI=`eval echo '$URI'$o`
116 1.1 christos if test $INDEXDB = indexdb ; then
117 1.1 christos INDEX1="olcDbIndex: objectClass,entryCSN,reqStart,reqDN,reqResult eq"
118 1.1 christos INDEX2="olcDbIndex: objectClass,entryCSN,entryUUID eq"
119 1.1 christos else
120 1.1 christos INDEX1=
121 1.1 christos INDEX2=
122 1.1 christos fi
123 1.1 christos cat >> $TMP <<EOF
124 1.1 christos dn: cn=schema,cn=config
125 1.1 christos objectclass: olcSchemaconfig
126 1.1 christos cn: schema
127 1.1 christos
128 1.1 christos include: file://$ABS_SCHEMADIR/core.ldif
129 1.1 christos
130 1.1 christos include: file://$ABS_SCHEMADIR/cosine.ldif
131 1.1 christos
132 1.1 christos include: file://$ABS_SCHEMADIR/inetorgperson.ldif
133 1.1 christos
134 1.1 christos include: file://$ABS_SCHEMADIR/openldap.ldif
135 1.1 christos
136 1.1 christos include: file://$ABS_SCHEMADIR/nis.ldif
137 1.1 christos
138 1.1 christos dn: olcDatabase={0}config,cn=config
139 1.1 christos objectClass: olcDatabaseConfig
140 1.1 christos olcDatabase: {0}config
141 1.1 christos olcRootPW:< file://$CONFIGPWF
142 1.1 christos
143 1.1 christos dn: olcDatabase={1}$BACKEND,cn=config
144 1.1 christos objectClass: olcDatabaseConfig
145 1.1 christos ${nullExclude}objectClass: olc${BACKEND}Config
146 1.1 christos olcDatabase: {1}$BACKEND
147 1.1 christos olcSuffix: cn=log
148 1.1 christos ${nullExclude}olcDbDirectory: ${DBDIR}.1
149 1.1 christos olcRootDN: $MANAGERDN
150 1.1 christos $INDEX1
151 1.1 christos
152 1.1 christos dn: olcOverlay=syncprov,olcDatabase={1}$BACKEND,cn=config
153 1.1 christos objectClass: olcOverlayConfig
154 1.1 christos objectClass: olcSyncProvConfig
155 1.1 christos olcOverlay: syncprov
156 1.1 christos olcSpNoPresent: TRUE
157 1.1 christos olcSpReloadHint: TRUE
158 1.1 christos
159 1.1 christos dn: olcDatabase={2}$BACKEND,cn=config
160 1.1 christos objectClass: olcDatabaseConfig
161 1.1 christos ${nullExclude}objectClass: olc${BACKEND}Config
162 1.1 christos olcDatabase: {2}$BACKEND
163 1.1 christos olcSuffix: $BASEDN
164 1.1 christos ${nullExclude}olcDbDirectory: ${DBDIR}.2
165 1.1 christos olcRootDN: $MANAGERDN
166 1.1 christos olcRootPW: $PASSWD
167 1.1 christos olcSyncRepl: rid=001 provider=$PROVIDERURI binddn="$MANAGERDN" bindmethod=simple
168 1.1 christos credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE retry="3 +" timeout=3
169 1.1 christos olcMirrorMode: TRUE
170 1.1 christos $INDEX2
171 1.1 christos
172 1.1 christos dn: olcOverlay=syncprov,olcDatabase={2}$BACKEND,cn=config
173 1.1 christos objectClass: olcOverlayConfig
174 1.1 christos objectClass: olcSyncProvConfig
175 1.1 christos olcOverlay: syncprov
176 1.1 christos olcSpSessionlogSource: cn=log
177 1.1 christos
178 1.1 christos dn: olcOverlay=accesslog,olcDatabase={2}$BACKEND,cn=config
179 1.1 christos objectClass: olcOverlayConfig
180 1.1 christos objectClass: olcAccessLogConfig
181 1.1 christos olcOverlay: accesslog
182 1.1 christos olcAccessLogDB: cn=log
183 1.1 christos olcAccessLogOps: writes
184 1.1 christos olcAccessLogSuccess: TRUE
185 1.1 christos
186 1.1 christos EOF
187 1.1 christos $SLAPADD -F $CFDIR -n 0 -d-1< $TMP > $TESTOUT 2>&1
188 1.1 christos PORT=`eval echo '$PORT'$n`
189 1.1 christos echo "Starting server $n on TCP/IP port $PORT..."
190 1.1 christos cd ${XDIR}${n}
191 1.1 christos LOG=`eval echo '$LOG'$n`
192 1.1 christos $SLAPD -F slapd.d -h $MYURI -d $LVL > $LOG 2>&1 &
193 1.1 christos PID=$!
194 1.1 christos if test $WAIT != 0 ; then
195 1.1 christos echo PID $PID
196 1.1 christos read foo
197 1.1 christos fi
198 1.1 christos KILLPIDS="$PID $KILLPIDS"
199 1.1 christos cd $TESTWD
200 1.1 christos
201 1.1 christos echo "Using ldapsearch to check that server $n is running..."
202 1.1 christos for i in 0 1 2 3 4 5; do
203 1.1 christos $LDAPSEARCH -s base -b "" -H $MYURI \
204 1.1 christos 'objectclass=*' > /dev/null 2>&1
205 1.1 christos RC=$?
206 1.1 christos if test $RC = 0 ; then
207 1.1 christos break
208 1.1 christos fi
209 1.1 christos echo "Waiting 5 seconds for slapd to start..."
210 1.1 christos sleep 5
211 1.1 christos done
212 1.1 christos
213 1.1 christos if test $RC != 0 ; then
214 1.1 christos echo "ldapsearch failed ($RC)!"
215 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
216 1.1 christos exit $RC
217 1.1 christos fi
218 1.1 christos
219 1.1 christos if [ $n = 1 ]; then
220 1.1 christos echo "Using ldapadd for context on server 1..."
221 1.1 christos $LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDEREDCP \
222 1.1 christos >> $TESTOUT 2>&1
223 1.1 christos RC=$?
224 1.1 christos if test $RC != 0 ; then
225 1.1 christos echo "ldapadd failed for server $n database ($RC)!"
226 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
227 1.1 christos exit $RC
228 1.1 christos fi
229 1.1 christos fi
230 1.1 christos
231 1.1 christos n=`expr $n + 1`
232 1.1 christos done
233 1.1 christos
234 1.1 christos echo "Using ldapadd to populate server 1..."
235 1.1 christos $LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDEREDNOCP \
236 1.1 christos >> $TESTOUT 2>&1
237 1.1 christos RC=$?
238 1.1 christos if test $RC != 0 ; then
239 1.1 christos echo "ldapadd failed for server 1 database ($RC)!"
240 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
241 1.1 christos exit $RC
242 1.1 christos fi
243 1.1 christos
244 1.1 christos echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
245 1.1 christos sleep $SLEEP1
246 1.1 christos
247 1.1 christos n=1
248 1.1 christos while [ $n -le $MMR ]; do
249 1.1 christos URI=`eval echo '$URI'$n`
250 1.1 christos
251 1.1 christos echo "Using ldapsearch to read all the entries from server $n..."
252 1.1 christos $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
253 1.1 christos 'objectclass=*' > $TESTDIR/server$n.out 2>&1
254 1.1 christos RC=$?
255 1.1 christos
256 1.1 christos if test $RC != 0 ; then
257 1.1 christos echo "ldapsearch failed at server $n ($RC)!"
258 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
259 1.1 christos exit $RC
260 1.1 christos fi
261 1.1 christos $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
262 1.1 christos n=`expr $n + 1`
263 1.1 christos done
264 1.1 christos
265 1.1 christos n=2
266 1.1 christos while [ $n -le $MMR ]; do
267 1.1 christos echo "Comparing retrieved entries from server 1 and server $n..."
268 1.1 christos $CMP $PROVIDERFLT $TESTDIR/server$n.flt > $CMPOUT
269 1.1 christos
270 1.1 christos if test $? != 0 ; then
271 1.1 christos echo "test failed - server 1 and server $n databases differ"
272 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
273 1.1 christos exit 1
274 1.1 christos fi
275 1.1 christos n=`expr $n + 1`
276 1.1 christos done
277 1.1 christos
278 1.1 christos echo "Using ldapadd to populate server 2..."
279 1.1 christos $LDAPADD -D "$MANAGERDN" -H $URI2 -w $PASSWD -f $LDIFADD1 \
280 1.1 christos >> $TESTOUT 2>&1
281 1.1 christos RC=$?
282 1.1 christos if test $RC != 0 ; then
283 1.1 christos echo "ldapadd failed for server 2 database ($RC)!"
284 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
285 1.1 christos exit $RC
286 1.1 christos fi
287 1.1 christos
288 1.1 christos THEDN="cn=James A Jones 2,ou=Alumni Association,ou=People,dc=example,dc=com"
289 1.1 christos sleep 1
290 1.1 christos for i in 1 2 3; do
291 1.1 christos $LDAPSEARCH -S "" -b "$THEDN" -H $URI1 \
292 1.1 christos -s base '(objectClass=*)' entryCSN > "${PROVIDEROUT}.$i" 2>&1
293 1.1 christos RC=$?
294 1.1 christos
295 1.1 christos if test $RC = 0 ; then
296 1.1 christos break
297 1.1 christos fi
298 1.1 christos
299 1.1 christos if test $RC != 32 ; then
300 1.1 christos echo "ldapsearch failed at slave ($RC)!"
301 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
302 1.1 christos exit $RC
303 1.1 christos fi
304 1.1 christos
305 1.1 christos echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
306 1.1 christos sleep $SLEEP1
307 1.1 christos done
308 1.1 christos
309 1.1 christos n=1
310 1.1 christos while [ $n -le $MMR ]; do
311 1.1 christos URI=`eval echo '$URI'$n`
312 1.1 christos
313 1.1 christos echo "Using ldapsearch to read all the entries from server $n..."
314 1.1 christos $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
315 1.1 christos 'objectclass=*' > $TESTDIR/server$n.out 2>&1
316 1.1 christos RC=$?
317 1.1 christos
318 1.1 christos if test $RC != 0 ; then
319 1.1 christos echo "ldapsearch failed at server $n ($RC)!"
320 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
321 1.1 christos exit $RC
322 1.1 christos fi
323 1.1 christos $LDIFFILTER < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
324 1.1 christos n=`expr $n + 1`
325 1.1 christos done
326 1.1 christos
327 1.1 christos n=2
328 1.1 christos while [ $n -le $MMR ]; do
329 1.1 christos echo "Comparing retrieved entries from server 1 and server $n..."
330 1.1 christos $CMP $PROVIDERFLT $TESTDIR/server$n.flt > $CMPOUT
331 1.1 christos
332 1.1 christos if test $? != 0 ; then
333 1.1 christos echo "test failed - server 1 and server $n databases differ"
334 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
335 1.1 christos exit 1
336 1.1 christos fi
337 1.1 christos n=`expr $n + 1`
338 1.1 christos done
339 1.1 christos
340 1.1 christos echo "Retrieving syncrepl cookie..."
341 1.1 christos cookie=`$LDAPRSEARCH -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD \
342 1.1 christos -E "sync=ro" 'objectclass=*' 1.1 | grep cookie | sed "s/.*cookie: //"`
343 1.1 christos
344 1.1 christos if test -z "$cookie"; then
345 1.1 christos echo "Failed to retrieve cookie from server!"
346 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
347 1.1 christos exit 1
348 1.1 christos fi
349 1.1 christos
350 1.1 christos echo "Deleting an entry from server 1..."
351 1.1 christos $LDAPDELETE -D "$MANAGERDN" -H $URI1 -w $PASSWD \
352 1.1 christos "cn=Mark Elliot,ou=Alumni Association,ou=People,$BASEDN" \
353 1.1 christos >> $TESTOUT 2>&1
354 1.1 christos RC=$?
355 1.1 christos if test $RC != 0 ; then
356 1.1 christos echo "ldapdelete failed for server 1 database ($RC)!"
357 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
358 1.1 christos exit $RC
359 1.1 christos fi
360 1.1 christos
361 1.1 christos
362 1.1 christos echo "Restarting servers..."
363 1.1 christos kill -HUP $KILLPIDS
364 1.1 christos wait
365 1.1 christos KILLPIDS=""
366 1.1 christos n=1
367 1.1 christos while [ $n -le $MMR ]; do
368 1.1 christos o=`expr 3 - $n`
369 1.1 christos MYURI=`eval echo '$URI'$n`
370 1.1 christos PROVIDERURI=`eval echo '$URI'$o`
371 1.1 christos
372 1.1 christos echo "Starting server $n again..."
373 1.1 christos cd ${XDIR}${n}
374 1.1 christos LOG=`eval echo '$LOG'$n`
375 1.1 christos echo "RESTART" >> $LOG
376 1.1 christos #if test $n = 2; then
377 1.1 christos #echo $SLAPD -F slapd.d -h $MYURI -d $LVL
378 1.1 christos #else
379 1.1 christos $SLAPD -F slapd.d -h $MYURI -d $LVL > $LOG 2>&1 &
380 1.1 christos #fi
381 1.1 christos PID=$!
382 1.1 christos if test $WAIT != 0 ; then
383 1.1 christos echo PID $PID
384 1.1 christos read foo
385 1.1 christos fi
386 1.1 christos KILLPIDS="$PID $KILLPIDS"
387 1.1 christos cd $TESTWD
388 1.1 christos
389 1.1 christos echo "Using ldapsearch to check that server $n is running..."
390 1.1 christos for i in 0 1 2 3 4 5; do
391 1.1 christos $LDAPSEARCH -s base -b "" -H $MYURI \
392 1.1 christos 'objectclass=*' > /dev/null 2>&1
393 1.1 christos RC=$?
394 1.1 christos if test $RC = 0 ; then
395 1.1 christos break
396 1.1 christos fi
397 1.1 christos echo "Waiting 5 seconds for slapd to start..."
398 1.1 christos sleep 5
399 1.1 christos done
400 1.1 christos
401 1.1 christos echo "Breaking replication between server $n and $o..."
402 1.1 christos $LDAPMODIFY -D cn=config -H $MYURI -y $CONFIGPWF > $TESTOUT 2>&1 <<EOF
403 1.1 christos dn: olcDatabase={2}$BACKEND,cn=config
404 1.1 christos changetype: modify
405 1.1 christos replace: olcSyncRepl
406 1.1 christos olcSyncRepl: rid=001 provider=$PROVIDERURI binddn="$MANAGERDN" bindmethod=simple
407 1.1 christos credentials=InvalidPw searchbase="$BASEDN" $SYNCTYPE retry="3 +" timeout=3
408 1.1 christos -
409 1.1 christos replace: olcMirrorMode
410 1.1 christos olcMirrorMode: TRUE
411 1.1 christos
412 1.1 christos EOF
413 1.1 christos RC=$?
414 1.1 christos if test $RC != 0 ; then
415 1.1 christos echo "ldapmodify failed for server $n config ($RC)!"
416 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
417 1.1 christos exit $RC
418 1.1 christos fi
419 1.1 christos n=`expr $n + 1`
420 1.1 christos done
421 1.1 christos
422 1.1 christos echo "Using ldapmodify to force conflicts between server 1 and 2..."
423 1.1 christos $LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
424 1.1 christos >> $TESTOUT 2>&1 << EOF
425 1.1 christos dn: $THEDN
426 1.1 christos changetype: modify
427 1.1 christos add: description
428 1.1 christos description: Amazing
429 1.1 christos
430 1.1 christos EOF
431 1.1 christos RC=$?
432 1.1 christos if test $RC != 0 ; then
433 1.1 christos echo "ldapmodify failed for server 1 database ($RC)!"
434 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
435 1.1 christos exit $RC
436 1.1 christos fi
437 1.1 christos
438 1.1 christos $LDAPMODIFY -D "$MANAGERDN" -H $URI2 -w $PASSWD \
439 1.1 christos >> $TESTOUT 2>&1 << EOF
440 1.1 christos dn: $THEDN
441 1.1 christos changetype: modify
442 1.1 christos add: description
443 1.1 christos description: Stupendous
444 1.1 christos
445 1.1 christos EOF
446 1.1 christos RC=$?
447 1.1 christos if test $RC != 0 ; then
448 1.1 christos echo "ldapmodify failed for server 2 database ($RC)!"
449 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
450 1.1 christos exit $RC
451 1.1 christos fi
452 1.1 christos
453 1.1 christos $LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
454 1.1 christos >> $TESTOUT 2>&1 << EOF
455 1.1 christos dn: $THEDN
456 1.1 christos changetype: modify
457 1.1 christos delete: description
458 1.1 christos description: Outstanding
459 1.1 christos -
460 1.1 christos add: description
461 1.1 christos description: Mindboggling
462 1.1 christos
463 1.1 christos EOF
464 1.1 christos RC=$?
465 1.1 christos if test $RC != 0 ; then
466 1.1 christos echo "ldapmodify failed for server 1 database ($RC)!"
467 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
468 1.1 christos exit $RC
469 1.1 christos fi
470 1.1 christos
471 1.1 christos $LDAPMODIFY -D "$MANAGERDN" -H $URI2 -w $PASSWD \
472 1.1 christos >> $TESTOUT 2>&1 << EOF
473 1.1 christos dn: $THEDN
474 1.1 christos changetype: modify
475 1.1 christos delete: description
476 1.1 christos description: OutStanding
477 1.1 christos -
478 1.1 christos add: description
479 1.1 christos description: Bizarre
480 1.1 christos
481 1.1 christos EOF
482 1.1 christos RC=$?
483 1.1 christos if test $RC != 0 ; then
484 1.1 christos echo "ldapmodify failed for server 2 database ($RC)!"
485 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
486 1.1 christos exit $RC
487 1.1 christos fi
488 1.1 christos
489 1.1 christos $LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
490 1.1 christos >> $TESTOUT 2>&1 << EOF
491 1.1 christos dn: $THEDN
492 1.1 christos changetype: modify
493 1.1 christos add: carLicense
494 1.1 christos carLicense: 123-XYZ
495 1.1 christos -
496 1.1 christos add: employeeNumber
497 1.1 christos employeeNumber: 32
498 1.1 christos
499 1.1 christos EOF
500 1.1 christos RC=$?
501 1.1 christos if test $RC != 0 ; then
502 1.1 christos echo "ldapmodify failed for server 1 database ($RC)!"
503 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
504 1.1 christos exit $RC
505 1.1 christos fi
506 1.1 christos
507 1.1 christos $LDAPMODIFY -D "$MANAGERDN" -H $URI2 -w $PASSWD \
508 1.1 christos >> $TESTOUT 2>&1 << EOF
509 1.1 christos dn: $THEDN
510 1.1 christos changetype: modify
511 1.1 christos add: employeeType
512 1.1 christos employeeType: deadwood
513 1.1 christos -
514 1.1 christos add: employeeNumber
515 1.1 christos employeeNumber: 64
516 1.1 christos
517 1.1 christos EOF
518 1.1 christos RC=$?
519 1.1 christos if test $RC != 0 ; then
520 1.1 christos echo "ldapmodify failed for server 2 database ($RC)!"
521 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
522 1.1 christos exit $RC
523 1.1 christos fi
524 1.1 christos
525 1.1 christos $LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
526 1.1 christos >> $TESTOUT 2>&1 << EOF
527 1.1 christos dn: $THEDN
528 1.1 christos changetype: modify
529 1.1 christos replace: sn
530 1.1 christos sn: Replaced later
531 1.1 christos -
532 1.1 christos replace: sn
533 1.1 christos sn: Surname
534 1.1 christos EOF
535 1.1 christos RC=$?
536 1.1 christos if test $RC != 0 ; then
537 1.1 christos echo "ldapmodify failed for server 1 database ($RC)!"
538 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
539 1.1 christos exit $RC
540 1.1 christos fi
541 1.1 christos
542 1.1 christos echo "Deleting an entry from both servers..."
543 1.1 christos $LDAPDELETE -D "$MANAGERDN" -H $URI1 -w $PASSWD \
544 1.1 christos "cn=John Doe,ou=Information Technology Division,ou=People,$BASEDN" \
545 1.1 christos >> $TESTOUT 2>&1
546 1.1 christos RC=$?
547 1.1 christos if test $RC != 0 ; then
548 1.1 christos echo "ldapdelete failed for server 1 database ($RC)!"
549 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
550 1.1 christos exit $RC
551 1.1 christos fi
552 1.1 christos
553 1.1 christos $LDAPDELETE -D "$MANAGERDN" -H $URI2 -w $PASSWD \
554 1.1 christos "cn=John Doe,ou=Information Technology Division,ou=People,$BASEDN" \
555 1.1 christos >> $TESTOUT 2>&1
556 1.1 christos RC=$?
557 1.1 christos if test $RC != 0 ; then
558 1.1 christos echo "ldapdelete failed for server 2 database ($RC)!"
559 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
560 1.1 christos exit $RC
561 1.1 christos fi
562 1.1 christos
563 1.1 christos echo "Restoring replication between server 1 and 2..."
564 1.1 christos n=1
565 1.1 christos while [ $n -le $MMR ]; do
566 1.1 christos o=`expr 3 - $n`
567 1.1 christos MYURI=`eval echo '$URI'$n`
568 1.1 christos PROVIDERURI=`eval echo '$URI'$o`
569 1.1 christos $LDAPMODIFY -D cn=config -H $MYURI -y $CONFIGPWF > $TESTOUT 2>&1 <<EOF
570 1.1 christos dn: olcDatabase={2}$BACKEND,cn=config
571 1.1 christos changetype: modify
572 1.1 christos replace: olcSyncRepl
573 1.1 christos olcSyncRepl: rid=001 provider=$PROVIDERURI binddn="$MANAGERDN" bindmethod=simple
574 1.1 christos credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE retry="3 +" timeout=3
575 1.1 christos -
576 1.1 christos replace: olcMirrorMode
577 1.1 christos olcMirrorMode: TRUE
578 1.1 christos
579 1.1 christos EOF
580 1.1 christos RC=$?
581 1.1 christos if test $RC != 0 ; then
582 1.1 christos echo "ldapmodify failed for server $n config ($RC)!"
583 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
584 1.1 christos exit $RC
585 1.1 christos fi
586 1.1 christos n=`expr $n + 1`
587 1.1 christos done
588 1.1 christos
589 1.1 christos echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
590 1.1 christos sleep $SLEEP1
591 1.1 christos
592 1.1 christos echo 2 >$TESTDIR/repl.test
593 1.1 christos echo 1 >>$TESTDIR/repl.test
594 1.1 christos
595 1.1 christos n=1
596 1.1 christos while [ $n -le $MMR ]; do
597 1.1 christos URI=`eval echo '$URI'$n`
598 1.1 christos
599 1.1 christos echo "Using ldapsearch to read all the entries from server $n..."
600 1.1 christos $LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
601 1.1 christos 'objectclass=*' > $TESTDIR/server$n.out 2>&1
602 1.1 christos RC=$?
603 1.1 christos
604 1.1 christos if test $RC != 0 ; then
605 1.1 christos echo "ldapsearch failed at server $n ($RC)!"
606 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
607 1.1 christos exit $RC
608 1.1 christos fi
609 1.1 christos $LDIFFILTER -s a < $TESTDIR/server$n.out > $TESTDIR/server$n.flt
610 1.1 christos
611 1.1 christos echo "Checking server $n can remember which entries have been deleted even after it's been restarted..."
612 1.1 christos $LDAPRSEARCH -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
613 1.1 christos -E "sync=ro/$cookie" 'objectclass=*' 1.1 | awk '/syncUUIDs/ {count++} END {print count}' >$TESTDIR/repl.out
614 1.1 christos $LDAPRSEARCH -b "$BASEDN" -D "$MANAGERDN" -H $URI -w $PASSWD \
615 1.1 christos -E "sync=ro/$cookie" 'objectclass=*' 1.1 | grep SyncDone | awk '/refreshDeletes=1/ {count++} END {print count}' >>$TESTDIR/repl.out
616 1.1 christos
617 1.1 christos $CMP $TESTDIR/repl.out $TESTDIR/repl.test > $CMPOUT
618 1.1 christos
619 1.1 christos if test $? != 0 ; then
620 1.1 christos echo "test failed - server did not respond with delete phase"
621 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
622 1.1 christos exit 1
623 1.1 christos fi
624 1.1 christos n=`expr $n + 1`
625 1.1 christos done
626 1.1 christos
627 1.1 christos n=2
628 1.1 christos while [ $n -le $MMR ]; do
629 1.1 christos echo "Comparing retrieved entries from server 1 and server $n..."
630 1.1 christos $CMP $PROVIDERFLT $TESTDIR/server$n.flt > $CMPOUT
631 1.1 christos
632 1.1 christos if test $? != 0 ; then
633 1.1 christos echo "test failed - server 1 and server $n databases differ"
634 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
635 1.1 christos exit 1
636 1.1 christos fi
637 1.1 christos n=`expr $n + 1`
638 1.1 christos done
639 1.1 christos
640 1.1 christos test $KILLSERVERS != no && kill -HUP $KILLPIDS
641 1.1 christos
642 1.1 christos echo ">>>>> Test succeeded"
643 1.1 christos
644 1.1 christos test $KILLSERVERS != no && wait
645 1.1 christos
646 1.1 christos exit 0
647