ITS#9346 Fix test063 to handle more servers

This commit is contained in:
Howard Chu 2020-09-12 21:49:43 +01:00
parent 57643b4347
commit 08b578ce85

View File

@ -25,7 +25,7 @@ if test $ACCESSLOG = accesslogno; then
exit 0 exit 0
fi fi
MPR=2 MPR=${MPR-4}
XDIR=$TESTDIR/srv XDIR=$TESTDIR/srv
TMP=$TESTDIR/tmp TMP=$TESTDIR/tmp
@ -76,15 +76,21 @@ CFDIR=${XDIR}$n/slapd.d
mkdir -p ${XDIR}$n $DBDIR.1 $DBDIR.2 $CFDIR mkdir -p ${XDIR}$n $DBDIR.1 $DBDIR.2 $CFDIR
o=`expr 3 - $n`
cat > $TMP <<EOF cat > $TMP <<EOF
dn: cn=config dn: cn=config
objectClass: olcGlobal objectClass: olcGlobal
cn: config cn: config
olcServerID: $n
EOF EOF
o=1
while [ $o -le $MPR ]; do
PORT=`expr $BASEPORT + $o`
URI="ldap://${LOCALHOST}:$PORT/"
echo "olcServerID: $o $URI" >> $TMP
o=`expr $o + 1`
done
echo "" >> $TMP
if [ "$SYNCPROV" = syncprovmod -o "$ACCESSLOG" = accesslogmod ]; then if [ "$SYNCPROV" = syncprovmod -o "$ACCESSLOG" = accesslogmod ]; then
cat <<EOF >> $TMP cat <<EOF >> $TMP
dn: cn=module,cn=config dn: cn=module,cn=config
@ -175,11 +181,23 @@ olcSuffix: $BASEDN
${nullExclude}olcDbDirectory: ${DBDIR}.2 ${nullExclude}olcDbDirectory: ${DBDIR}.2
olcRootDN: $MANAGERDN olcRootDN: $MANAGERDN
olcRootPW: $PASSWD olcRootPW: $PASSWD
olcSyncRepl: rid=001 provider=$PROVIDERURI binddn="$MANAGERDN" bindmethod=simple EOF
o=1
while [ $o -le $MPR ]; do
PORT=`expr $BASEPORT + $o`
URI="ldap://${LOCALHOST}:$PORT/"
cat >>$TMP <<EOF
olcSyncRepl: rid=00$o provider=$URI binddn="$MANAGERDN" bindmethod=simple
credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
retry="3 +" timeout=3 logbase="cn=log" retry="3 +" timeout=3 logbase="cn=log"
logfilter="(&(objectclass=auditWriteObject)(reqresult=0))" logfilter="(&(objectclass=auditWriteObject)(reqresult=0))"
syncdata=accesslog syncdata=accesslog
EOF
o=`expr $o + 1`
done
cat >> $TMP <<EOF
olcMultiProvider: TRUE olcMultiProvider: TRUE
$INDEX2 $INDEX2
@ -222,6 +240,7 @@ KILLPIDS="$PID $KILLPIDS"
cd $TESTWD cd $TESTWD
echo "Using ldapsearch to check that server $n is running..." echo "Using ldapsearch to check that server $n is running..."
sleep 1
for i in 0 1 2 3 4 5; do for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "" -H $MYURI \ $LDAPSEARCH -s base -b "" -H $MYURI \
'objectclass=*' > /dev/null 2>&1 'objectclass=*' > /dev/null 2>&1
@ -364,22 +383,14 @@ done
echo "Breaking replication between server 1 and 2..." echo "Breaking replication between server 1 and 2..."
n=1 n=1
while [ $n -le $MPR ]; do while [ $n -le 2 ]; do
o=`expr 3 - $n`
MYURI=`eval echo '$URI'$n` MYURI=`eval echo '$URI'$n`
PROVIDERURI=`eval echo '$URI'$o` o=`expr $n - 1`
$LDAPMODIFY -D cn=config -H $MYURI -y $CONFIGPWF > $TESTOUT 2>&1 <<EOF $LDAPMODIFY -D cn=config -H $MYURI -y $CONFIGPWF > $TESTOUT 2>&1 <<EOF
dn: olcDatabase={2}$BACKEND,cn=config dn: olcDatabase={2}$BACKEND,cn=config
changetype: modify changetype: modify
replace: olcSyncRepl delete: olcSyncRepl
olcSyncRepl: rid=001 provider=$PROVIDERURI binddn="$MANAGERDN" bindmethod=simple
credentials=InvalidPw searchbase="$BASEDN" $SYNCTYPE
retry="3 +" timeout=3 logbase="cn=log"
logfilter="(&(objectclass=auditWriteObject)(reqresult=0))"
syncdata=accesslog
- -
replace: olcMultiProvider
olcMultiProvider: TRUE
EOF EOF
RC=$? RC=$?
@ -512,25 +523,33 @@ if test $RC != 0 ; then
fi fi
echo "Restoring replication between server 1 and 2..." echo "Restoring replication between server 1 and 2..."
n=1 cat > $TMP <<EOF
while [ $n -le $MPR ]; do
o=`expr 3 - $n`
MYURI=`eval echo '$URI'$n`
PROVIDERURI=`eval echo '$URI'$o`
$LDAPMODIFY -D cn=config -H $MYURI -y $CONFIGPWF > $TESTOUT 2>&1 <<EOF
dn: olcDatabase={2}$BACKEND,cn=config dn: olcDatabase={2}$BACKEND,cn=config
changetype: modify changetype: modify
replace: olcSyncRepl add: olcSyncRepl
olcSyncRepl: rid=001 provider=$PROVIDERURI binddn="$MANAGERDN" bindmethod=simple EOF
n=1
while [ $n -le $MPR ]; do
MYURI=`eval echo '$URI'$n`
PROVIDERURI=`eval echo '$URI'$n`
cat >> $TMP <<EOF
olcSyncRepl: rid=00$n provider=$PROVIDERURI binddn="$MANAGERDN" bindmethod=simple
credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE
retry="3 +" timeout=3 logbase="cn=log" retry="3 +" timeout=3 logbase="cn=log"
logfilter="(&(objectclass=auditWriteObject)(reqresult=0))" logfilter="(&(objectclass=auditWriteObject)(reqresult=0))"
syncdata=accesslog syncdata=accesslog
EOF
n=`expr $n + 1`
done
cat >> $TMP <<EOF
- -
replace: olcMultiProvider replace: olcMultiProvider
olcMultiProvider: TRUE olcMultiProvider: TRUE
EOF EOF
n=1
while [ $n -le 2 ]; do
MYURI=`eval echo '$URI'$n`
$LDAPMODIFY -D cn=config -H $MYURI -y $CONFIGPWF > $TESTOUT 2>&1 <$TMP
RC=$? RC=$?
if test $RC != 0 ; then if test $RC != 0 ; then
echo "ldapmodify failed for server $n config ($RC)!" echo "ldapmodify failed for server $n config ($RC)!"