ITS#5540 sean-burford-monitor-test-080706.patch

This commit is contained in:
Howard Chu 2009-01-27 10:09:51 +00:00
parent fb6dfb852d
commit b64a6cddd3
5 changed files with 312 additions and 0 deletions

31
tests/data/monitor1.out Normal file
View File

@ -0,0 +1,31 @@
dn: cn=Connection 1,cn=Connections,cn=Monitor
structuralObjectClass: monitorConnection
monitorConnectionProtocol: 3
monitorConnectionOpsReceived: 2
monitorConnectionOpsExecuting: 1
monitorConnectionOpsPending: 0
monitorConnectionOpsCompleted: 1
monitorConnectionGet: 2
monitorConnectionRead: 2
monitorConnectionWrite: 0
monitorConnectionMask: rx
monitorConnectionListener: ldap://localhost:9011/
monitorConnectionLocalAddress: IP=127.0.0.1:9011
entryDN: cn=Connection 1,cn=Connections,cn=Monitor
dn: cn=Connections,cn=Monitor
structuralObjectClass: monitorContainer
entryDN: cn=Connections,cn=Monitor
dn: cn=Current,cn=Connections,cn=Monitor
structuralObjectClass: monitorCounterObject
entryDN: cn=Current,cn=Connections,cn=Monitor
dn: cn=Max File Descriptors,cn=Connections,cn=Monitor
structuralObjectClass: monitorCounterObject
entryDN: cn=Max File Descriptors,cn=Connections,cn=Monitor
dn: cn=Total,cn=Connections,cn=Monitor
structuralObjectClass: monitorCounterObject
entryDN: cn=Total,cn=Connections,cn=Monitor

40
tests/data/monitor2.out Normal file
View File

@ -0,0 +1,40 @@
dn: cn=Database 0,cn=Databases,cn=Monitor
structuralObjectClass: monitoredObject
monitorIsShadow: FALSE
namingContexts: cn=config
readOnly: FALSE
entryDN: cn=Database 0,cn=Databases,cn=Monitor
dn: cn=Database 1,cn=Databases,cn=Monitor
structuralObjectClass: monitoredObject
monitorIsShadow: FALSE
namingContexts: o=OpenLDAP Project,l=Internet
readOnly: FALSE
olmBDBEntryCache: 0
olmBDBDNCache: 0
olmBDBIDLCache: 0
entryDN: cn=Database 1,cn=Databases,cn=Monitor
dn: cn=Database 2,cn=Databases,cn=Monitor
structuralObjectClass: monitoredObject
monitorIsShadow: FALSE
monitorContext: cn=Monitor
readOnly: FALSE
entryDN: cn=Database 2,cn=Databases,cn=Monitor
dn: cn=Databases,cn=Monitor
structuralObjectClass: monitorContainer
readOnly: FALSE
namingContexts:
namingContexts: cn=config
namingContexts: o=OpenLDAP Project,l=Internet
monitorContext: cn=Monitor
entryDN: cn=Databases,cn=Monitor
dn: cn=Frontend,cn=Databases,cn=Monitor
structuralObjectClass: monitoredObject
monitorIsShadow: FALSE
namingContexts:
readOnly: FALSE
entryDN: cn=Frontend,cn=Databases,cn=Monitor

15
tests/data/monitor3.out Normal file
View File

@ -0,0 +1,15 @@
dn: cn=Entries,cn=Statistics,cn=Monitor
structuralObjectClass: monitorCounterObject
monitorCounter: 12
entryDN: cn=Entries,cn=Statistics,cn=Monitor
dn: cn=PDU,cn=Statistics,cn=Monitor
structuralObjectClass: monitorCounterObject
monitorCounter: 18
entryDN: cn=PDU,cn=Statistics,cn=Monitor
dn: cn=Referrals,cn=Statistics,cn=Monitor
structuralObjectClass: monitorCounterObject
monitorCounter: 0
entryDN: cn=Referrals,cn=Statistics,cn=Monitor

66
tests/data/monitor4.out Normal file
View File

@ -0,0 +1,66 @@
dn: cn=Abandon,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 0
monitorOpCompleted: 0
entryDN: cn=Abandon,cn=Operations,cn=Monitor
dn: cn=Add,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 0
monitorOpCompleted: 0
entryDN: cn=Add,cn=Operations,cn=Monitor
dn: cn=Bind,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 5
monitorOpCompleted: 5
entryDN: cn=Bind,cn=Operations,cn=Monitor
dn: cn=Compare,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 0
monitorOpCompleted: 0
entryDN: cn=Compare,cn=Operations,cn=Monitor
dn: cn=Delete,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 0
monitorOpCompleted: 0
entryDN: cn=Delete,cn=Operations,cn=Monitor
dn: cn=Extended,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 0
monitorOpCompleted: 0
entryDN: cn=Extended,cn=Operations,cn=Monitor
dn: cn=Modify,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 0
monitorOpCompleted: 0
entryDN: cn=Modify,cn=Operations,cn=Monitor
dn: cn=Modrdn,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 0
monitorOpCompleted: 0
entryDN: cn=Modrdn,cn=Operations,cn=Monitor
dn: cn=Operations,cn=Monitor
structuralObjectClass: monitorContainer
monitorOpInitiated: 14
monitorOpCompleted: 13
entryDN: cn=Operations,cn=Monitor
dn: cn=Search,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 5
monitorOpCompleted: 4
entryDN: cn=Search,cn=Operations,cn=Monitor
dn: cn=Unbind,cn=Operations,cn=Monitor
structuralObjectClass: monitorOperation
monitorOpInitiated: 4
monitorOpCompleted: 4
entryDN: cn=Unbind,cn=Operations,cn=Monitor

160
tests/scripts/test056-monitor Executable file
View File

@ -0,0 +1,160 @@
#! /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>.
echo "running defines.sh"
. $SRCDIR/scripts/defines.sh
mkdir -p $TESTDIR $DBDIR1
echo "Starting slapd on TCP/IP port $PORT..."
. $CONFFILTER $BACKEND $MONITORDB < $SCHEMACONF > $CONF1
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
KILLPIDS="$PID"
sleep 1
echo "Using ldapsearch to check that slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for slapd to start..."
sleep 5
done
echo "Using ldapsearch to read connection monitor entries..."
$LDAPSEARCH -S "" -b "$CONNECTIONSMONITORDN" -h $LOCALHOST -p $PORT1 \
'objectclass=*' \
structuralObjectClass entryDN \
monitorConnectionProtocol monitorConnectionOpsReceived \
monitorConnectionOpsExecuting monitorConnectionOpsPending \
monitorConnectionOpsCompleted monitorConnectionGet \
monitorConnectionRead monitorConnectionWrite \
monitorConnectionMask monitorConnectionAuthzDN \
monitorConnectionListener monitorConnectionLocalAddress \
> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Filtering ldapsearch results..."
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $MONITOROUT1 > $CMPOUT
if test $? != 0 ; then
echo "comparison failed - connection monitor output is not correct"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Using ldapsearch to read database monitor entries..."
$LDAPSEARCH -S "" -b "$DATABASESMONITORDN" -h $LOCALHOST -p $PORT1 \
'objectclass=*' \
structuralObjectClass entryDN namingContexts readOnly \
monitorIsShadow monitorContext \
olmBDBEntryCache olmBDBDNCache olmBDBIDLCache \
> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Filtering ldapsearch results..."
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $MONITOROUT2 > $CMPOUT
if test $? != 0 ; then
echo "comparison failed - database monitor output is not correct"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Using ldapsearch to read statistics monitor entries..."
$LDAPSEARCH -S "" -b "$STATISTICSMONITORDN" -h $LOCALHOST -p $PORT1 \
'(|(cn=Entries)(cn=PDU)(cn=Referrals))' \
structuralObjectClass monitorCounter entryDN \
> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Filtering ldapsearch results..."
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $MONITOROUT3 > $CMPOUT
if test $? != 0 ; then
echo "comparison failed - statistics monitor output is not correct"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
echo "Using ldapsearch to read operation monitor entries..."
$LDAPSEARCH -S "" -b "$OPERATIONSMONITORDN" -h $LOCALHOST -p $PORT1 \
'objectclass=*' \
structuralObjectClass monitorOpInitiated monitorOpCompleted entryDN \
> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Filtering ldapsearch results..."
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $MONITOROUT4 > $CMPOUT
if test $? != 0 ; then
echo "comparison failed - operations monitor output is not correct"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo ">>>>> Test succeeded"
test $KILLSERVERS != no && wait
exit 0