rootpw secret
#bdb#index objectClass eq
#bdb#index cn,sn,uid pres,eq,sub
+#bdb#checkpoint 1 1
#hdb#index objectClass eq
#hdb#index cn,sn,uid pres,eq,sub
+#hdb#checkpoint 1 1
#monitor#database monitor
}
done:;
- fprintf( stderr, " PID=%ld - Add/Delete done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Add/Delete done (%d).\n", (long) pid, rc );
ldap_unbind_ext( ld, NULL, NULL );
}
}
if ( maxloop > 1 ) {
- fprintf( stderr, " PID=%ld - Bind done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Bind done (%d).\n", (long) pid, rc );
}
if ( ldp && noinit ) {
end = GetTickCount();
end -= beg;
- fprintf( stderr, " PID=%ld - Bind done %d in %d.%03d seconds.\n",
+ fprintf( stderr, " PID=%ld - Bind done %d in %d.%03d seconds.\n",
(long) pid, i, end / 1000, end % 1000 );
#else
gettimeofday( &end, NULL );
}
end.tv_sec -= beg.tv_sec;
- fprintf( stderr, " PID=%ld - Bind done %d in %ld.%06ld seconds.\n",
+ fprintf( stderr, " PID=%ld - Bind done %d in %ld.%06ld seconds.\n",
(long) pid, i, (long) end.tv_sec, (long) end.tv_usec );
#endif
}
done:;
- fprintf( stderr, " PID=%ld - Modify done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Modify done (%d).\n", (long) pid, rc );
ldap_unbind_ext( ld, NULL, NULL );
}
}
done:;
- fprintf( stderr, " PID=%ld - Modrdn done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Modrdn done (%d).\n", (long) pid, rc );
ldap_unbind_ext( ld, NULL, NULL );
}
break;
}
- fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
if ( ld != NULL ) {
ldap_unbind_ext( ld, NULL, NULL );
*ldp = ld;
} else {
- fprintf( stderr, " PID=%ld - Read done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Read done (%d).\n", (long) pid, rc );
if ( ld != NULL ) {
ldap_unbind_ext( ld, NULL, NULL );
break;
}
- fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
if ( ld != NULL ) {
ldap_unbind_ext( ld, NULL, NULL );
*ldp = ld;
} else {
- fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
+ fprintf( stderr, " PID=%ld - Search done (%d).\n", (long) pid, rc );
if ( ld != NULL ) {
ldap_unbind_ext( ld, NULL, NULL );
LDIFFILTER=$SRCDIR/scripts/acfilter.sh
CONFFILTER=$SRCDIR/scripts/conf.sh
+MONITORDATA=$SRCDIR/scripts/monitor_data.sh
+
SLAPADD="$TESTWD/../servers/slapd/slapd -Ta -d 0 $LDAP_VERBOSE"
SLAPCAT="$TESTWD/../servers/slapd/slapd -Tc -d 0 $LDAP_VERBOSE"
SLAPINDEX="$TESTWD/../servers/slapd/slapd -Ti -d 0 $LDAP_VERBOSE"
--- /dev/null
+#! /bin/sh
+# $OpenLDAP$
+## This work is part of OpenLDAP Software <http://www.openldap.org/>.
+##
+## Copyright 1998-2008 The OpenLDAP Foundation.
+## All rights reserved.
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted only as authorized by the OpenLDAP
+## Public License.
+##
+## A copy of this license is available in the file LICENSE in the
+## top-level directory of the distribution or, alternatively, at
+## <http://www.OpenLDAP.org/license.html>.
+
+MONITORDB="$1"
+SRCDIR="$2"
+DSTDIR="$3"
+
+echo "MONITORDB $MONITORDB"
+echo "SRCDIR $SRCDIR"
+echo "DSTDIR $DSTDIR"
+echo "pwd `pwd`"
+
+# copy test data
+cp "$SRCDIR"/do_* "$DSTDIR"
+if test $MONITORDB != no ; then
+
+ # add back-monitor testing data
+ cat >> "$DSTDIR/do_search.0" << EOF
+cn=Monitor
+(objectClass=*)
+cn=Monitor
+(objectClass=*)
+cn=Monitor
+(objectClass=*)
+cn=Monitor
+(objectClass=*)
+EOF
+
+ cat >> "$DSTDIR/do_read.0" << EOF
+cn=Backend 1,cn=Backends,cn=Monitor
+cn=Entries,cn=Statistics,cn=Monitor
+cn=Database 1,cn=Databases,cn=Monitor
+EOF
+
+fi
+
echo "running defines.sh"
. $SRCDIR/scripts/defines.sh
+if test x$LOOPS = x ; then
+ LOOPS=50
+fi
+
mkdir -p $TESTDIR $DBDIR1
echo "Running slapadd to build slapd database..."
sleep 5
done
+# fix test data to include back-monitor, if available
+# NOTE: copies do_* files from $DATADIR to $TESTDIR
+$MONITORDATA "$MONITORDB" "$DATADIR" "$TESTDIR"
+
echo "Using tester for concurrent server access..."
-time $SLAPDTESTER -P "$PROGDIR" -d "$DATADIR" -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -l 50
-#$SLAPDTESTER -P "$PROGDIR" -d "$DATADIR" -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -l 50
+time $SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR" -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -l $LOOPS
+#$SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR" -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -l $LOOPS
RC=$?
if test $RC != 0 ; then
echo "Using ldapsearch to read all the entries from the master..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
- 'objectclass=*' > $MASTEROUT 2>&1
+ '(objectClass=*)' '*' entryCSN > $MASTEROUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "Using ldapsearch to read all the entries from the R1 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
- 'objectclass=*' > $SERVER2OUT 2>&1
+ '(objectClass=*)' '*' entryCSN > $SERVER2OUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "Using ldapsearch to read all the entries from the R2 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT3 \
- 'objectclass=*' > $SERVER3OUT 2>&1
+ '(objectClass=*)' '*' entryCSN > $SERVER3OUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "Using ldapsearch to read all the entries from the P1 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \
- 'objectclass=*' > $SERVER4OUT 2>&1
+ '(objectClass=*)' '*' entryCSN > $SERVER4OUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "Using ldapsearch to read all the entries from the P2 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT5 \
- 'objectclass=*' > $SERVER5OUT 2>&1
+ '(objectClass=*)' '*' entryCSN > $SERVER5OUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "Using ldapsearch to read all the entries from the P3 slave..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT6 \
- 'objectclass=*' > $SERVER6OUT 2>&1
+ '(objectClass=*)' '*' entryCSN > $SERVER6OUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "" >> $f
done
+# fix test data to include back-monitor, if available
+# NOTE: copies do_* files from $TESTDIR/$DATADIR to $TESTDIR
+$MONITORDATA "$MONITORDB" "$TESTDIR/$DATADIR" "$TESTDIR"
+
echo "Using tester for concurrent server access..."
-$SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 \
+$SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR" -h $LOCALHOST -p $PORT3 \
-D "cn=Manager,$METABASEDN" -w $PASSWD -l $TESTLOOPS -r 20 -FF \
-i '!REFERRAL'
RC=$?
echo "" >> $f
done
+# fix test data to include back-monitor, if available
+# NOTE: copies do_* files from $TESTDIR/$DATADIR to $TESTDIR
+$MONITORDATA "$MONITORDB" "$TESTDIR/$DATADIR" "$TESTDIR"
+
echo "Using tester for concurrent server access..."
-$SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR/$DATADIR" -h $LOCALHOST -p $PORT3 \
+$SLAPDTESTER -P "$PROGDIR" -d "$TESTDIR" -h $LOCALHOST -p $PORT3 \
-D "cn=Manager,$METABASEDN" -w $PASSWD \
-l $TESTLOOPS -L $TESTOLOOPS -r 20 -FF \
-i '!REFERRAL'
CFCON=$CONDIR/slapd.d
CFCON2=$CONDIR2/slapd.d
+SYNCTYPE="type=refreshOnly interval=00:00:00:10"
+#SYNCTYPE="type=refreshAndPersist"
+
mkdir -p $TESTDIR $PRODIR $CONDIR $CONDIR2 $DBPRO $DBCON $DBCON2 $CFPRO $CFCON $CFCON2
$SLAPPASSWD -g -n >$CONFIGPWF
#
# Test replication of dynamic config:
# - start producer
-# - start consumer
+# - start consumer1
# - start consumer2
# - configure over ldap
# - populate over ldap
exit $RC
fi
-echo "Starting consumer slapd on TCP/IP port $PORT2..."
+echo "Starting consumer1 slapd on TCP/IP port $PORT2..."
cd $CONDIR
$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
SLAVEPID=$!
sleep 1
-echo "Using ldapsearch to check that consumer slapd is running..."
+echo "Using ldapsearch to check that consumer1 slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "" -H $URI2 \
'objectclass=*' > /dev/null 2>&1
exit $RC
fi
-echo "Configuring syncrepl on consumer..."
+echo "Configuring syncrepl on consumer1..."
$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <<EOF >>$TESTOUT 2>&1
dn: olcDatabase={0}config,cn=config
changetype: modify
olcRootDN: $MANAGERDN
olcRootPW: $PASSWD
olcSyncRepl: rid=004 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple
- credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
- interval=00:00:00:10 retry="5 5 300 5" timeout=3
+ credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
+ retry="5 5 300 5" timeout=3
olcSyncRepl: rid=005 provider=$URI2 binddn="$MANAGERDN" bindmethod=simple
- credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
- interval=00:00:00:10 retry="5 5 300 5" timeout=3
+ credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
+ retry="5 5 300 5" timeout=3
olcSyncRepl: rid=006 provider=$URI3 binddn="$MANAGERDN" bindmethod=simple
- credentials=$PASSWD searchbase="$BASEDN" type=refreshOnly
- interval=00:00:00:10 retry="5 5 300 5" timeout=3
+ credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
+ retry="5 5 300 5" timeout=3
olcMirrorMode: TRUE
dn: olcOverlay=syncprov,olcDatabase={1}${BACKEND},cn=config
echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
sleep $SLEEP
-echo "Using ldapadd to populate consumer..."
+echo "Using ldapadd to populate consumer1..."
$LDAPADD -D "$MANAGERDN" -H $URI2 -w $PASSWD -f $LDIFADD1 \
>> $TESTOUT 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapadd failed for consumer database ($RC)!"
+ echo "ldapadd failed for consumer1 database ($RC)!"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit $RC
+fi
+
+SLEEP=20
+echo "Waiting $SLEEP seconds for syncrepl to receive changes..."
+sleep $SLEEP
+
+echo "Using ldapadd to populate consumer2..."
+$LDAPADD -D "$MANAGERDN" -H $URI3 -w $PASSWD \
+ << EOMODS >> $TESTOUT 2>&1
+dn: cn=Consumer 2 Test,dc=example,dc=com
+changetype: add
+objectClass: device
+cn: Consumer 2 Test
+EOMODS
+RC=$?
+if test $RC != 0 ; then
+ echo "ldapadd failed for consumer2 database ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
exit $RC
fi
-echo "Using ldapsearch to read config from the consumer..."
+echo "Using ldapsearch to read config from consumer1..."
$LDAPSEARCH -b cn=config -D cn=config -H $URI2 -y $CONFIGPWF \
'objectclass=*' > $SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed at consumer ($RC)!"
+ echo "ldapsearch failed at consumer1 ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Filtering producer results..."
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
-echo "Filtering consumer results..."
+echo "Filtering consumer1 results..."
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
echo "Filtering consumer2 results..."
. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
-echo "Comparing retrieved configs from producer and consumer..."
+echo "Comparing retrieved configs from producer and consumer1..."
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
if test $? != 0 ; then
- echo "test failed - producer and consumer configs differ"
+ echo "test failed - producer and consumer1 configs differ"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
exit $RC
fi
-echo "Using ldapsearch to read all the entries from the consumer..."
+echo "Using ldapsearch to read all the entries from consumer1..."
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \
'objectclass=*' > $SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
- echo "ldapsearch failed at consumer ($RC)!"
+ echo "ldapsearch failed at consumer1 ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
-echo "Using ldapsearch to read all the entries from the consumer2..."
+echo "Using ldapsearch to read all the entries from consumer2..."
$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI3 -w $PASSWD \
'objectclass=*' > $SLAVE2OUT 2>&1
RC=$?
exit $RC
fi
-
-test $KILLSERVERS != no && kill -HUP $KILLPIDS
+# kill!
+# test $KILLSERVERS != no && kill -HUP $KILLPIDS
+kill -HUP $KILLPIDS
echo "Filtering producer results..."
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
-echo "Filtering consumer results..."
+echo "Filtering consumer1 results..."
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
echo "Filtering consumer2 results..."
. $LDIFFILTER < $SLAVE2OUT > $SLAVE2FLT
-echo "Comparing retrieved entries from producer and consumer..."
+echo "Comparing retrieved entries from producer and consumer1..."
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
if test $? != 0 ; then
- echo "test failed - producer and consumer databases differ"
+ echo "test failed - producer and consumer1 databases differ"
exit 1
fi
exit 1
fi
-test $KILLSERVERS != no && wait
+# kill!
+# test $KILLSERVERS != no && wait
+wait
echo "Restarting servers..."
echo "Starting producer slapd on TCP/IP port $PORT1..."
exit $RC
fi
#exit 0
-echo "Starting consumer slapd on TCP/IP port $PORT2..."
+echo "Starting consumer1 slapd on TCP/IP port $PORT2..."
cd $CONDIR
echo "======================= RESTART =======================" >> $LOG2
$SLAPD -F ./slapd.d -h $URI2 -d $LVL $TIMING >> $LOG2 2>&1 &
sleep 1
-echo "Using ldapsearch to check that consumer slapd is running..."
+echo "Using ldapsearch to check that consumer1 slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "" -H $URI2 \
'objectclass=*' > /dev/null 2>&1