2
# $OpenLDAP: pkg/ldap/tests/scripts/test050-syncrepl-multimaster,v 1.3.2.8 2008/05/05 21:42:54 quanah Exp $
2
# $OpenLDAP: pkg/ldap/tests/scripts/test050-syncrepl-multimaster,v 1.3.2.13 2009/02/02 22:42:42 quanah Exp $
3
3
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
5
## Copyright 1998-2008 The OpenLDAP Foundation.
5
## Copyright 1998-2009 The OpenLDAP Foundation.
6
6
## All rights reserved.
8
8
## Redistribution and use in source and binary forms, with or without
320
336
olcRootDN: $MANAGERDN
321
337
olcRootPW: $PASSWD
322
338
olcSyncRepl: rid=004 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
323
credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
324
interval=00:00:00:10 retry="5 5 300 5" timeout=3
339
credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
340
retry="5 5 300 5" timeout=3
325
341
olcSyncRepl: rid=005 provider=$URI2 binddn="$MANAGERDN" bindmethod=simple
326
credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
327
interval=00:00:00:10 retry="5 5 300 5" timeout=3
342
credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
343
retry="5 5 300 5" timeout=3
328
344
olcSyncRepl: rid=006 provider=$URI3 binddn="$MANAGERDN" bindmethod=simple
329
credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
330
interval=00:00:00:10 retry="5 5 300 5" timeout=3
345
credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
346
retry="5 5 300 5" timeout=3
331
347
olcMirrorMode: TRUE
333
349
dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
364
$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
365
dn: olcDatabase={1}$BACKEND,cn=config
368
olcDbIndex: objectClass,entryUUID,entryCSN eq
369
olcDbIndex: cn,uid pres,eq,sub
372
if test $RC != 0 ; then
373
echo "ldapadd modify for database config ($RC)!"
374
test $KILLSERVERS != no && kill -HUP $KILLPIDS
346
380
echo "Using ldapadd to populate producer..."
347
381
$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \
357
391
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
360
echo "Using ldapadd to populate consumer..."
394
echo "Using ldapadd to populate consumer1..."
361
395
$LDAPADD -D "$MANAGERDN" -H $URI2 -w $PASSWD -f $LDIFADD1 \
364
398
if test $RC != 0 ; then
365
echo "ldapadd failed for consumer database ($RC)!"
399
echo "ldapadd failed for consumer1 database ($RC)!"
400
test $KILLSERVERS != no && kill -HUP $KILLPIDS
405
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
408
echo "Using ldapadd to populate consumer2..."
409
$LDAPADD -D "$MANAGERDN" -H $URI3 -w $PASSWD \
410
<< EOMODS >> $TESTOUT 2>&1
411
dn: cn=Consumer 2 Test,dc=example,dc=com
417
if test $RC != 0 ; then
418
echo "ldapadd failed for consumer2 database ($RC)!"
419
test $KILLSERVERS != no && kill -HUP $KILLPIDS
424
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
427
echo "Using ldapmodify to add to the producer entries that will be deleted..."
428
$LDAPMODIFY -D "$MANAGERDN" -H $URI1 -w $PASSWD \
429
>> $TESTOUT 2>&1 << EOADDS
430
dn: cn=To be deleted by producer,dc=example,dc=com
433
# no distinguished values, will be added by DSA
435
dn: cn=To be deleted by consumer1,dc=example,dc=com
438
# no distinguished values, will be added by DSA
440
dn: cn=To be deleted by consumer2,dc=example,dc=com
443
# no distinguished values, will be added by DSA
445
dn: cn=To be deleted by producer,dc=example,dc=com
449
if test $RC != 0 ; then
450
echo "ldapmodify failed for producer database ($RC)!"
451
test $KILLSERVERS != no && kill -HUP $KILLPIDS
456
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
459
echo "Using ldapmodify to delete entries from consumer1..."
460
$LDAPMODIFY -D "$MANAGERDN" -H $URI2 -w $PASSWD \
461
>> $TESTOUT 2>&1 << EOADDS
462
dn: cn=To be deleted by consumer1,dc=example,dc=com
466
if test $RC != 0 ; then
467
echo "ldapmodify failed for consumer1 database ($RC)!"
468
test $KILLSERVERS != no && kill -HUP $KILLPIDS
473
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
476
echo "Using ldapmodify to delete entries from consumer2..."
477
$LDAPMODIFY -D "$MANAGERDN" -H $URI3 -w $PASSWD \
478
>> $TESTOUT 2>&1 << EOADDS
479
dn: cn=To be deleted by consumer2,dc=example,dc=com
483
if test $RC != 0 ; then
484
echo "ldapmodify failed for consumer2 database ($RC)!"
366
485
test $KILLSERVERS != no && kill -HUP $KILLPIDS
425
echo "Using ldapsearch to read config from the consumer..."
544
echo "Using ldapsearch to read config from consumer1..."
426
545
$LDAPSEARCH -b cn=config -D cn=config -H $URI2 -y $CONFIGPWF \
427
546
'objectclass=*' > $SLAVEOUT 2>&1
430
549
if test $RC != 0 ; then
431
echo "ldapsearch failed at consumer ($RC)!"
550
echo "ldapsearch failed at consumer1 ($RC)!"
432
551
test $KILLSERVERS != no && kill -HUP $KILLPIDS
447
566
echo "Filtering producer results..."
448
567
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
449
echo "Filtering consumer results..."
568
echo "Filtering consumer1 results..."
450
569
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
451
570
echo "Filtering consumer2 results..."
452
571
. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
454
echo "Comparing retrieved configs from producer and consumer..."
573
echo "Comparing retrieved configs from producer and consumer1..."
455
574
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
457
576
if test $? != 0 ; then
458
echo "test failed - producer and consumer configs differ"
577
echo "test failed - producer and consumer1 configs differ"
459
578
test $KILLSERVERS != no && kill -HUP $KILLPIDS
483
echo "Using ldapsearch to read all the entries from the consumer..."
602
echo "Using ldapsearch to read all the entries from consumer1..."
484
603
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \
485
604
'objectclass=*' > $SLAVEOUT 2>&1
488
607
if test $RC != 0 ; then
489
echo "ldapsearch failed at consumer ($RC)!"
608
echo "ldapsearch failed at consumer1 ($RC)!"
490
609
test $KILLSERVERS != no && kill -HUP $KILLPIDS
494
echo "Using ldapsearch to read all the entries from the consumer2..."
613
echo "Using ldapsearch to read all the entries from consumer2..."
495
614
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD \
496
615
'objectclass=*' > $SLAVE2OUT 2>&1
506
test $KILLSERVERS != no && kill -HUP $KILLPIDS
625
# test $KILLSERVERS != no && kill -HUP $KILLPIDS
508
628
echo "Filtering producer results..."
509
629
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
510
echo "Filtering consumer results..."
630
echo "Filtering consumer1 results..."
511
631
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
512
632
echo "Filtering consumer2 results..."
513
633
. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
515
echo "Comparing retrieved entries from producer and consumer..."
635
echo "Comparing retrieved entries from producer and consumer1..."
516
636
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
518
638
if test $? != 0 ; then
519
echo "test failed - producer and consumer databases differ"
639
echo "test failed - producer and consumer1 databases differ"