~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

Viewing changes to tests/scripts/test048-syncrepl-multiproxy

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2008-07-10 14:45:49 UTC
  • Revision ID: james.westby@ubuntu.com-20080710144549-wck73med0e72gfyo
Tags: upstream-2.4.10
ImportĀ upstreamĀ versionĀ 2.4.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# $OpenLDAP: pkg/ldap/tests/scripts/test048-syncrepl-multiproxy,v 1.1.2.6 2008/02/11 23:26:51 kurt Exp $
 
3
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
 
4
##
 
5
## Copyright 1998-2008 The OpenLDAP Foundation.
 
6
## All rights reserved.
 
7
##
 
8
## Redistribution and use in source and binary forms, with or without
 
9
## modification, are permitted only as authorized by the OpenLDAP
 
10
## Public License.
 
11
##
 
12
## A copy of this license is available in the file LICENSE in the
 
13
## top-level directory of the distribution or, alternatively, at
 
14
## <http://www.OpenLDAP.org/license.html>.
 
15
 
 
16
echo "running defines.sh"
 
17
. $SRCDIR/scripts/defines.sh
 
18
 
 
19
if test $BACKLDAP = ldapno; then 
 
20
        echo "LDAP backend not available, test skipped"
 
21
        exit 0
 
22
fi 
 
23
 
 
24
if test $SYNCPROV = syncprovno; then 
 
25
        echo "Syncrepl provider overlay not available, test skipped"
 
26
        exit 0
 
27
fi 
 
28
 
 
29
if test $MONITORDB = no; then 
 
30
        echo "Monitor backend not available, test skipped"
 
31
        exit 0
 
32
fi 
 
33
 
 
34
mkdir -p $TESTDIR $DBDIR1 $DBDIR2 $DBDIR3
 
35
 
 
36
#
 
37
# Test replication:
 
38
# - start master
 
39
# - start slave
 
40
# - populate over ldap
 
41
# - perform some modifies and deleted
 
42
# - attempt to modify the slave (referral or chain)
 
43
# - retrieve database over ldap and compare against expected results
 
44
#
 
45
 
 
46
echo "Starting master slapd on TCP/IP port $PORT1..."
 
47
. $CONFFILTER $BACKEND $MONITORDB < $PLSRMASTERCONF > $CONF1
 
48
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
 
49
MASTERPID=$!
 
50
if test $WAIT != 0 ; then
 
51
    echo MASTERPID $MASTERPID
 
52
    read foo
 
53
fi
 
54
KILLPIDS="$MASTERPID"
 
55
 
 
56
sleep 1
 
57
 
 
58
echo "Using ldapsearch to check that master slapd is running..."
 
59
for i in 0 1 2 3 4 5; do
 
60
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
 
61
                '(objectClass=*)' > /dev/null 2>&1
 
62
        RC=$?
 
63
        if test $RC = 0 ; then
 
64
                break
 
65
        fi
 
66
        echo "Waiting 5 seconds for slapd to start..."
 
67
        sleep 5
 
68
done
 
69
 
 
70
if test $RC != 0 ; then
 
71
        echo "ldapsearch failed ($RC)!"
 
72
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
73
        exit $RC
 
74
fi
 
75
 
 
76
echo "Using ldapadd to create the context prefix entry in the master..."
 
77
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
 
78
        $LDIFORDEREDCP > /dev/null 2>&1
 
79
RC=$?
 
80
if test $RC != 0 ; then
 
81
        echo "ldapadd failed ($RC)!"
 
82
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
83
        exit $RC
 
84
fi
 
85
 
 
86
echo "Starting P1 slave slapd on TCP/IP port $PORT2..."
 
87
. $CONFFILTER $BACKEND $MONITORDB < $RSLAVECONF > $CONF2
 
88
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
 
89
P1SLAVEPID=$!
 
90
if test $WAIT != 0 ; then
 
91
    echo P1SLAVEPID $P1SLAVEPID
 
92
    read foo
 
93
fi
 
94
KILLPIDS="$MASTERPID $P1SLAVEPID"
 
95
 
 
96
sleep 1
 
97
 
 
98
echo "Using ldapsearch to check that P1 slave slapd is running..."
 
99
for i in 0 1 2 3 4 5; do
 
100
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
 
101
                '(objectClass=*)' > /dev/null 2>&1
 
102
        RC=$?
 
103
        if test $RC = 0 ; then
 
104
                break
 
105
        fi
 
106
        echo "Waiting 5 seconds for slapd to start..."
 
107
        sleep 5
 
108
done
 
109
 
 
110
if test $RC != 0 ; then
 
111
        echo "ldapsearch failed ($RC)!"
 
112
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
113
        exit $RC
 
114
fi
 
115
 
 
116
echo "Starting R1 slave slapd on TCP/IP port $PORT3..."
 
117
. $CONFFILTER $BACKEND $MONITORDB < $RSLAVECONF | sed -e 's;\.2\.;.3.;' > $CONF3
 
118
$SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING > $LOG3 2>&1 &
 
119
R1SLAVEPID=$!
 
120
if test $WAIT != 0 ; then
 
121
    echo R1SLAVEPID $R1SLAVEPID
 
122
    read foo
 
123
fi
 
124
KILLPIDS="$MASTERPID $P1SLAVEPID $R1SLAVEPID"
 
125
 
 
126
sleep 1
 
127
 
 
128
echo "Using ldapsearch to check that R1 slave slapd is running..."
 
129
for i in 0 1 2 3 4 5; do
 
130
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \
 
131
                '(objectClass=*)' > /dev/null 2>&1
 
132
        RC=$?
 
133
        if test $RC = 0; then
 
134
                break
 
135
        fi
 
136
        echo "Waiting 5 seconds for slapd to start..."
 
137
        sleep 5
 
138
done
 
139
 
 
140
if test $RC != 0 ; then
 
141
        echo "ldapsearch failed ($RC)!"
 
142
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
143
        exit $RC
 
144
fi
 
145
 
 
146
CHECK=1
 
147
echo "$CHECK > Using ldapadd to populate the master directory..."
 
148
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
 
149
        $LDIFORDEREDNOCP > /dev/null 2>&1
 
150
RC=$?
 
151
if test $RC != 0 ; then
 
152
        echo "ldapadd failed ($RC)!"
 
153
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
154
        exit $RC
 
155
fi
 
156
 
 
157
SLEEP=15
 
158
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
 
159
sleep $SLEEP
 
160
 
 
161
#echo "Using ldapsearch to read all the entries from the master..."
 
162
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
 
163
        '(objectClass=*)' > "${MASTEROUT}.1" 2>&1
 
164
RC=$?
 
165
 
 
166
if test $RC != 0 ; then
 
167
        echo "ldapsearch failed at master ($RC)!"
 
168
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
169
        exit $RC
 
170
fi
 
171
 
 
172
#echo "Using ldapsearch to read all the entries from the P1 slave..."
 
173
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
 
174
        '(objectClass=*)' > "${SLAVEOUT}.1" 2>&1
 
175
RC=$?
 
176
 
 
177
if test $RC != 0 ; then
 
178
        echo "ldapsearch failed at P1 slave ($RC)!"
 
179
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
180
        exit $RC
 
181
fi
 
182
 
 
183
#echo "Filtering master results..."
 
184
. $LDIFFILTER < "${MASTEROUT}.1" > $MASTERFLT
 
185
#echo "Filtering slave results..."
 
186
. $LDIFFILTER < "${SLAVEOUT}.1" > $SLAVEFLT
 
187
 
 
188
echo "$CHECK < Comparing retrieved entries from master and P1 slave..."
 
189
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
 
190
 
 
191
if test $? != 0 ; then
 
192
        echo "test failed - master and P1 slave databases differ"
 
193
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
194
        exit 1
 
195
fi
 
196
 
 
197
#echo "Using ldapsearch to read all the entries from the R1 slave..."
 
198
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT3 \
 
199
        '(objectClass=*)' > "${SLAVEOUT}.1" 2>&1
 
200
RC=$?
 
201
 
 
202
if test $RC != 0 ; then
 
203
        echo "ldapsearch failed at R1 slave ($RC)!"
 
204
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
205
        exit $RC
 
206
fi
 
207
 
 
208
#echo "Filtering slave results..."
 
209
. $LDIFFILTER < "${SLAVEOUT}.1" > $SLAVEFLT
 
210
 
 
211
echo "$CHECK < Comparing retrieved entries from master and R1 slave..."
 
212
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
 
213
 
 
214
if test $? != 0 ; then
 
215
        echo "test failed - master and R1 slave databases differ"
 
216
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
217
        exit 1
 
218
fi
 
219
 
 
220
CHECK=`expr $CHECK + 1`
 
221
SLEEP=10
 
222
echo "$CHECK > Stopping the provider, sleeping $SLEEP seconds and restarting it..."
 
223
kill -HUP "$MASTERPID"
 
224
wait $MASTERPID
 
225
sleep $SLEEP
 
226
 
 
227
echo "======================= RESTART =======================" >> $LOG1
 
228
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING >> $LOG1 2>&1 &
 
229
MASTERPID=$!
 
230
if test $WAIT != 0 ; then
 
231
    echo MASTERPID $MASTERPID
 
232
    read foo
 
233
fi
 
234
KILLPIDS="$MASTERPID $P1SLAVEPID $R1SLAVEPID"
 
235
 
 
236
sleep 1
 
237
 
 
238
echo "Using ldapsearch to check that master slapd is running..."
 
239
for i in 0 1 2 3 4 5; do
 
240
        $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
 
241
                '(objectClass=*)' > /dev/null 2>&1
 
242
        RC=$?
 
243
        if test $RC = 0 ; then
 
244
                break
 
245
        fi
 
246
        echo "Waiting 5 seconds for slapd to start..."
 
247
        sleep 5
 
248
done
 
249
 
 
250
if test $RC != 0 ; then
 
251
        echo "ldapsearch failed ($RC)!"
 
252
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
253
        exit $RC
 
254
fi
 
255
 
 
256
echo "Using ldapmodify to modify master directory..."
 
257
 
 
258
#
 
259
# Do some modifications
 
260
#
 
261
 
 
262
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD > \
 
263
        $TESTOUT 2>&1 << EOMODS
 
264
dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
 
265
changetype: modify
 
266
add: drink
 
267
drink: Orange Juice
 
268
-
 
269
delete: sn
 
270
sn: Jones
 
271
-
 
272
add: sn
 
273
sn: Jones
 
274
 
 
275
dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
 
276
changetype: modify
 
277
replace: drink
 
278
drink: Iced Tea
 
279
 
 
280
dn: cn=ITD Staff,ou=Groups,dc=example,dc=com
 
281
changetype: modify
 
282
delete: uniquemember
 
283
uniquemember: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
 
284
uniquemember: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
 
285
-
 
286
add: uniquemember
 
287
uniquemember: cn=Dorothy Stevens, ou=Alumni Association, ou=People, dc=example,dc=com
 
288
uniquemember: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example,dc=com
 
289
 
 
290
dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,dc=example,dc
 
291
 =com
 
292
changetype: modify
 
293
delete: cn
 
294
cn: Biiff Jensen
 
295
 
 
296
dn: cn=Gern Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
 
297
changetype: add
 
298
objectclass: OpenLDAPperson
 
299
cn: Gern Jensen
 
300
sn: Jensen
 
301
uid: gjensen
 
302
title: Chief Investigator, ITD
 
303
postaladdress: ITD $ 535 W. William St $ Ann Arbor, MI 48103
 
304
seealso: cn=All Staff, ou=Groups, dc=example,dc=com
 
305
drink: Coffee
 
306
homepostaladdress: 844 Brown St. Apt. 4 $ Ann Arbor, MI 48104
 
307
description: Very odd
 
308
facsimiletelephonenumber: +1 313 555 7557
 
309
telephonenumber: +1 313 555 8343
 
310
mail: gjensen@mailgw.example.com
 
311
homephone: +1 313 555 8844
 
312
 
 
313
dn: ou=Retired, ou=People, dc=example,dc=com
 
314
changetype: add
 
315
objectclass: organizationalUnit
 
316
ou: Retired
 
317
 
 
318
dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
 
319
changetype: add
 
320
objectclass: OpenLDAPperson
 
321
cn: Rosco P. Coltrane
 
322
sn: Coltrane
 
323
uid: rosco
 
324
description: Fat tycoon
 
325
 
 
326
dn: cn=Rosco P. Coltrane, ou=Information Technology Division, ou=People, dc=example,dc=com
 
327
changetype: modrdn
 
328
newrdn: cn=Rosco P. Coltrane
 
329
deleteoldrdn: 1
 
330
newsuperior: ou=Retired, ou=People, dc=example,dc=com
 
331
 
 
332
dn: cn=James A Jones 2, ou=Information Technology Division, ou=People, dc=example,dc=com
 
333
changetype: delete
 
334
EOMODS
 
335
 
 
336
RC=$?
 
337
if test $RC != 0 ; then
 
338
        echo "ldapmodify failed ($RC)!"
 
339
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
340
        exit $RC
 
341
fi
 
342
 
 
343
SLEEP=15
 
344
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
 
345
sleep $SLEEP
 
346
 
 
347
#echo "Using ldapsearch to read all the entries from the master..."
 
348
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
 
349
        '(objectClass=*)' > "${MASTEROUT}.2" 2>&1
 
350
RC=$?
 
351
 
 
352
if test $RC != 0 ; then
 
353
        echo "ldapsearch failed at master ($RC)!"
 
354
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
355
        exit $RC
 
356
fi
 
357
 
 
358
#echo "Using ldapsearch to read all the entries from the P1 slave..."
 
359
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
 
360
        '(objectClass=*)' > "${SLAVEOUT}.2" 2>&1
 
361
RC=$?
 
362
 
 
363
if test $RC != 0 ; then
 
364
        echo "ldapsearch failed at P1 slave ($RC)!"
 
365
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
366
        exit $RC
 
367
fi
 
368
 
 
369
#echo "Filtering master results..."
 
370
. $LDIFFILTER < "${MASTEROUT}.2" > $MASTERFLT
 
371
#echo "Filtering P1 slave results..."
 
372
. $LDIFFILTER < "${SLAVEOUT}.2" > $SLAVEFLT
 
373
 
 
374
echo "$CHECK < Comparing retrieved entries from master and P1 slave..."
 
375
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
 
376
 
 
377
if test $? != 0 ; then
 
378
        echo "test failed - master and P1 slave databases differ"
 
379
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
380
        exit 1
 
381
fi
 
382
 
 
383
#echo "Using ldapsearch to read all the entries from the R1 slave..."
 
384
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT3 \
 
385
        '(objectClass=*)' > "${SLAVEOUT}.2" 2>&1
 
386
RC=$?
 
387
 
 
388
if test $RC != 0 ; then
 
389
        echo "ldapsearch failed at R1 slave ($RC)!"
 
390
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
391
        exit $RC
 
392
fi
 
393
 
 
394
#echo "Filtering slave results..."
 
395
. $LDIFFILTER < "${SLAVEOUT}.2" > $SLAVEFLT
 
396
 
 
397
echo "$CHECK < Comparing retrieved entries from master and R1 slave..."
 
398
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
 
399
 
 
400
if test $? != 0 ; then
 
401
        echo "test failed - master and R1 slave databases differ"
 
402
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
403
        exit 1
 
404
fi
 
405
 
 
406
CHECK=`expr $CHECK + 1`
 
407
echo "$CHECK > Stopping slaves to test recovery..."
 
408
kill -HUP $P1SLAVEPID $R1SLAVEPID
 
409
wait $P1SLAVEPID
 
410
wait $R1SLAVEPID
 
411
 
 
412
echo "Modifying more entries on the master..."
 
413
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
 
414
        $TESTOUT 2>&1 << EOMODS
 
415
dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
 
416
changetype: modify
 
417
add: description
 
418
description: r1 slave is down...
 
419
 
 
420
dn: cn=James T. Kirk, ou=Retired, ou=People, dc=example,dc=com
 
421
changetype: add
 
422
objectclass: OpenLDAPperson
 
423
sn: Kirk
 
424
uid: jtk
 
425
cn: James T. Kirk
 
426
 
 
427
dn: cn=Tiberius J. Hooker, ou=Retired, ou=People, dc=example,dc=com
 
428
changetype: add
 
429
objectclass: OpenLDAPperson
 
430
sn: Hooker
 
431
uid: tjh
 
432
cn: Tiberius J. Hooker
 
433
 
 
434
EOMODS
 
435
 
 
436
echo "Restarting P1 slave..."
 
437
echo "======================= RESTART =======================" >> $LOG3
 
438
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
 
439
P1SLAVEPID=$!
 
440
if test $WAIT != 0 ; then
 
441
    echo P1SLAVEPID $P1SLAVEPID
 
442
    read foo
 
443
fi
 
444
 
 
445
echo "Restarting R1 slave..."
 
446
echo "======================= RESTART =======================" >> $LOG3
 
447
$SLAPD -f $CONF3 -h $URI3 -d $LVL $TIMING >> $LOG3 2>&1 &
 
448
R1SLAVEPID=$!
 
449
if test $WAIT != 0 ; then
 
450
    echo R1SLAVEPID $R1SLAVEPID
 
451
    read foo
 
452
fi
 
453
KILLPIDS="$MASTERPID $P1SLAVEPID $R1SLAVEPID"
 
454
 
 
455
SLEEP=25
 
456
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
 
457
sleep $SLEEP
 
458
 
 
459
#echo "Using ldapsearch to read all the entries from the master..."
 
460
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
 
461
        '(objectClass=*)' > "${MASTEROUT}.3" 2>&1
 
462
RC=$?
 
463
 
 
464
if test $RC != 0 ; then
 
465
        echo "ldapsearch failed at master ($RC)!"
 
466
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
467
        exit $RC
 
468
fi
 
469
 
 
470
#echo "Using ldapsearch to read all the entries from the P1 slave..."
 
471
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
 
472
        '(objectClass=*)' > "${SLAVEOUT}.3" 2>&1
 
473
RC=$?
 
474
 
 
475
if test $RC != 0 ; then
 
476
        echo "ldapsearch failed at slave ($RC)!"
 
477
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
478
        exit $RC
 
479
fi
 
480
 
 
481
#echo "Filtering master results..."
 
482
. $LDIFFILTER < "${MASTEROUT}.3" > $MASTERFLT
 
483
#echo "Filtering slave results..."
 
484
. $LDIFFILTER < "${SLAVEOUT}.3" > $SLAVEFLT
 
485
 
 
486
echo "$CHECK < Comparing retrieved entries from master and P1 slave..."
 
487
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
 
488
 
 
489
if test $? != 0 ; then
 
490
        echo "test failed - master and slave databases differ"
 
491
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
492
        exit 1
 
493
fi
 
494
 
 
495
#echo "Using ldapsearch to read all the entries from the R1 slave..."
 
496
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT3 \
 
497
        '(objectClass=*)' > "${SLAVEOUT}.3" 2>&1
 
498
RC=$?
 
499
 
 
500
if test $RC != 0 ; then
 
501
        echo "ldapsearch failed at slave ($RC)!"
 
502
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
503
        exit $RC
 
504
fi
 
505
 
 
506
#echo "Filtering slave results..."
 
507
. $LDIFFILTER < "${SLAVEOUT}.3" > $SLAVEFLT
 
508
 
 
509
echo "$CHECK < Comparing retrieved entries from master and R1 slave..."
 
510
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
 
511
 
 
512
if test $? != 0 ; then
 
513
        echo "test failed - master and slave databases differ"
 
514
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
515
        exit 1
 
516
fi
 
517
 
 
518
CHECK=`expr $CHECK + 1`
 
519
echo "$CHECK > Try updating the P1 slave slapd..."
 
520
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD > \
 
521
        $TESTOUT 2>&1 << EOMODS
 
522
dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
 
523
changetype: modify
 
524
add: description
 
525
description: This write must fail because directed to a shadow context,
 
526
description: unless the chain overlay is configured appropriately ;)
 
527
 
 
528
EOMODS
 
529
 
 
530
RC=$?
 
531
if test $RC != 0 ; then
 
532
        echo "ldapmodify failed ($RC)!"
 
533
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
534
        exit $RC
 
535
fi
 
536
 
 
537
SLEEP=15
 
538
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
 
539
sleep $SLEEP
 
540
 
 
541
#echo "Using ldapsearch to read all the entries from the master..."
 
542
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
 
543
        '(objectClass=*)' > "${MASTEROUT}.4" 2>&1
 
544
RC=$?
 
545
 
 
546
if test $RC != 0 ; then
 
547
        echo "ldapsearch failed at master ($RC)!"
 
548
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
549
        exit $RC
 
550
fi
 
551
 
 
552
#echo "Using ldapsearch to read all the entries from the P1 slave..."
 
553
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
 
554
'(objectClass=*)' > "${SLAVEOUT}.4" 2>&1
 
555
RC=$?
 
556
 
 
557
if test $RC != 0 ; then
 
558
        echo "ldapsearch failed at slave ($RC)!"
 
559
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
560
        exit $RC
 
561
fi
 
562
 
 
563
#echo "Filtering master results..."
 
564
. $LDIFFILTER < "${MASTEROUT}.4" > $MASTERFLT
 
565
#echo "Filtering slave results..."
 
566
. $LDIFFILTER < "${SLAVEOUT}.4" > $SLAVEFLT
 
567
 
 
568
echo "$CHECK < Comparing retrieved entries from master and P1 slave..."
 
569
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
 
570
 
 
571
if test $? != 0 ; then
 
572
        echo "test failed - master and P1 slave databases differ"
 
573
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
574
        exit 1
 
575
fi
 
576
 
 
577
#echo "Using ldapsearch to read all the entries from the R1 slave..."
 
578
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT3 \
 
579
'(objectClass=*)' > "${SLAVEOUT}.4" 2>&1
 
580
RC=$?
 
581
 
 
582
if test $RC != 0 ; then
 
583
        echo "ldapsearch failed at slave ($RC)!"
 
584
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
585
        exit $RC
 
586
fi
 
587
 
 
588
#echo "Filtering slave results..."
 
589
. $LDIFFILTER < "${SLAVEOUT}.4" > $SLAVEFLT
 
590
 
 
591
echo "$CHECK < Comparing retrieved entries from master and R1 slave..."
 
592
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
 
593
 
 
594
if test $? != 0 ; then
 
595
        echo "test failed - master and R1 slave databases differ"
 
596
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
597
        exit 1
 
598
fi
 
599
 
 
600
test $KILLSERVERS != no && kill -HUP $KILLPIDS
 
601
 
 
602
echo ">>>>> Test succeeded"
 
603
 
 
604
test $KILLSERVERS != no && wait
 
605
 
 
606
exit 0