mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
ITS#9197 Increase timeouts in test case due to sporadic failures
This commit is contained in:
parent
14013507ec
commit
3db2e4a073
@ -54,7 +54,7 @@ ACI=${AC_ACI_ENABLED-acino}
|
||||
SLEEP0=${SLEEP0-1}
|
||||
SLEEP1=${SLEEP1-7}
|
||||
SLEEP2=${SLEEP2-15}
|
||||
TIMEOUT=${TIMEOUT-4}
|
||||
TIMEOUT=${TIMEOUT-8}
|
||||
|
||||
# dirs
|
||||
PROGDIR=./progs
|
||||
|
@ -73,8 +73,9 @@ sleep $SLEEP0
|
||||
# Test 1: Test that shared connections are timed out
|
||||
#
|
||||
|
||||
NOW=`date +%s`
|
||||
echo "Create shared connection towards remote LDAP (time_t now=$NOW timeout=`expr $NOW + $TIMEOUT`)"
|
||||
CONN_BEGINS=`date +%s`
|
||||
CONN_EXPIRES=`expr $CONN_BEGINS + $TIMEOUT`
|
||||
echo "Create shared connection towards remote LDAP (time_t now=$CONN_BEGINS timeout=$CONN_EXPIRES)"
|
||||
|
||||
$LDAPSEARCH -b "dc=idle-timeout,$BASEDN" \
|
||||
-D "cn=Manager,dc=local,dc=com" \
|
||||
@ -102,7 +103,7 @@ fi
|
||||
|
||||
# Check that connections are established by searching for olmDbConnURI from Monitor
|
||||
|
||||
echo "Checking that proxy has created connections towards backend"
|
||||
echo "Checking that proxy has created connections towards backend (time_t now=`date +%s`)"
|
||||
|
||||
$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
|
||||
-D "cn=Manager,dc=local,dc=com" \
|
||||
@ -129,9 +130,10 @@ fi
|
||||
# Wait for connections to be closed, either due to
|
||||
# - idle-timeout and
|
||||
# - conn-ttl
|
||||
|
||||
# sleep 2 second overtime for robustness of the test case
|
||||
echo "Sleeping until idle-timeout and conn-ttl have passed"
|
||||
sleep `expr $TIMEOUT + 1`
|
||||
NOW=`date +%s`
|
||||
sleep `expr $CONN_EXPIRES - $NOW + 2`
|
||||
|
||||
echo "Checking that proxy has closed expired connections towards the remote LDAP server (time_t now=`date +%s`)"
|
||||
|
||||
@ -163,8 +165,9 @@ fi
|
||||
# Test 2: Test that private connections are timed out
|
||||
#
|
||||
|
||||
NOW=`date +%s`
|
||||
echo "Create private connection towards remote LDAP (time_t now=$NOW timeout=`expr $NOW + $TIMEOUT`)"
|
||||
CONN_BEGINS=`date +%s`
|
||||
CONN_EXPIRES=`expr $CONN_BEGINS + $TIMEOUT`
|
||||
echo "Create private connection towards remote LDAP (time_t now=$CONN_BEGINS timeout=$CONN_EXPIRES)"
|
||||
|
||||
# Create fifos that are used to pass searches from the test case to ldapsearch
|
||||
rm -f $TESTDIR/ldapsearch1.fifo $TESTDIR/ldapsearch2.fifo
|
||||
@ -192,9 +195,11 @@ exec 4>$TESTDIR/ldapsearch2.fifo
|
||||
# Trigger LDAP connections towards the proxy by executing a search
|
||||
echo 'objectclass=*' >&3
|
||||
echo 'objectclass=*' >&4
|
||||
sleep 1
|
||||
|
||||
echo "Checking that proxy has created connections towards backend"
|
||||
# wait for ldapsearches (running as background processes) to execute search operations
|
||||
sleep 2
|
||||
|
||||
echo "Checking that proxy has created connections towards backend (time_t now=`date +%s`)"
|
||||
|
||||
$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
|
||||
-D "cn=Manager,dc=local,dc=com" \
|
||||
@ -218,9 +223,13 @@ if test $RC != 0 ; then
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
|
||||
# Wait for connections to be closed, either due to
|
||||
# - idle-timeout and
|
||||
# - conn-ttl
|
||||
# sleep 2 second overtime for robustness of the test case
|
||||
echo "Sleeping until idle-timeout and conn-ttl have passed"
|
||||
sleep `expr $TIMEOUT + 1`
|
||||
NOW=`date +%s`
|
||||
sleep `expr $CONN_EXPIRES - $NOW + 2`
|
||||
|
||||
echo "Checking that proxy has closed expired connections towards the remote LDAP server (time_t now=`date +%s`)"
|
||||
|
||||
@ -258,8 +267,9 @@ exec 4>&-
|
||||
#
|
||||
|
||||
echo "Checking that idle-timeout is reset on activity"
|
||||
NOW=`date +%s`
|
||||
echo "Create cached connection: idle-timeout timeout starts (time_t now=$NOW, original_timeout=`expr $NOW + $TIMEOUT`)"
|
||||
CONN_BEGINS=`date +%s`
|
||||
CONN_EXPIRES=`expr $CONN_BEGINS + $TIMEOUT`
|
||||
echo "Create cached connection: idle-timeout timeout starts (time_t now=$CONN_BEGINS, original_timeout=$CONN_EXPIRES)"
|
||||
$LDAPSEARCH -b "dc=idle-timeout,$BASEDN" \
|
||||
-D "cn=Manager,dc=local,dc=com" \
|
||||
-H $URI2 \
|
||||
@ -272,10 +282,13 @@ if test $RC != 0 ; then
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
# sleep second less than idle-timeout to extend the timeout
|
||||
sleep `expr $TIMEOUT - 1`
|
||||
# sleep until 2 seconds before idle-timeout, then extend the timeout by executing another search operation
|
||||
NOW=`date +%s`
|
||||
echo "Do another search to reset the timeout (time_t now=$NOW, new_timeout=`expr $NOW + $TIMEOUT`)"
|
||||
sleep `expr $CONN_EXPIRES - $NOW - 2`
|
||||
|
||||
CONN_BEGINS=`date +%s`
|
||||
CONN_EXPIRES=`expr $CONN_BEGINS + $TIMEOUT`
|
||||
echo "Do another search to reset the timeout (time_t now=$CONN_BEGINS, new_timeout=$CONN_EXPIRES)"
|
||||
$LDAPSEARCH -b "dc=idle-timeout,$BASEDN" \
|
||||
-D "cn=Manager,dc=local,dc=com" \
|
||||
-H $URI2 \
|
||||
@ -288,7 +301,9 @@ if test $RC != 0 ; then
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
sleep `expr $TIMEOUT - 1`
|
||||
# sleep until 2 seconds before new exteneded idle-timeout, check that connection still exist
|
||||
NOW=`date +%s`
|
||||
sleep `expr $CONN_EXPIRES - $NOW - 2`
|
||||
echo "Check that connection is still alive due to idle-timeout reset (time_t now=`date +%s`)"
|
||||
$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
|
||||
-D "cn=Manager,dc=local,dc=com" \
|
||||
@ -301,7 +316,9 @@ if test $RC != 0 ; then
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
# sleep until 2 seconds after timeout, check that connection does not exist
|
||||
NOW=`date +%s`
|
||||
sleep `expr $CONN_EXPIRES - $NOW + 2`
|
||||
echo "Check that connection is closed after extended idle-timeout has passed (time_t now=`date +%s`)"
|
||||
$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
|
||||
-D "cn=Manager,dc=local,dc=com" \
|
||||
@ -314,7 +331,6 @@ if test $RC != 1 ; then
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
|
||||
echo ">>>>> Test succeeded"
|
||||
|
Loading…
Reference in New Issue
Block a user