ITS#10363 Fixed the broken asyncmeta con-ttl test

Fixed the incorrect filespaths, added the correct test statements
and added some comments
This commit is contained in:
Nadezhda Ivanova 2026-02-27 14:59:23 +02:00 committed by Quanah Gibson-Mount
parent 745503ec3b
commit d1fd1a385b
6 changed files with 88 additions and 53 deletions

View file

@ -5,3 +5,4 @@ olmTargetConnFlags: closed
dn: cn=Target Connection 2,cn=Connection Group 1,cn=Connections,cn=database 1,
cn=databases,cn=monitor
olmTargetConnFlags: closed

View file

@ -5,3 +5,4 @@ olmTargetConnFlags: closed
dn: cn=Target Connection 2,cn=Connection Group 2,cn=Connections,cn=database 1,
cn=databases,cn=monitor
olmTargetConnFlags: closed

View file

@ -29,3 +29,4 @@ olmTargetConnFlags: anonymous,initialized
dn: cn=Target Connection 2,cn=Connection Group 3,cn=Connections,cn=database 1,
cn=databases,cn=monitor
olmTargetConnFlags: anonymous,initialized

View file

@ -21,3 +21,4 @@ olmTargetConnFlags: closed
dn: cn=Target Connection 2,cn=Connection Group 3,cn=Connections,cn=database 1,
cn=databases,cn=monitor
olmTargetConnFlags: closed

View file

@ -46,7 +46,7 @@ network-timeout 500
#max-timeout-ops 50
#max-pending-ops 128
max-target-conns 3
conn-ttl 10s 5s
conn-ttl 6s 6s
monitoring on

View file

@ -45,7 +45,7 @@ if test $WAIT != 0 ; then
fi
KILLPIDS="$PID"
sleep 1
sleep $SLEEP0
echo "Using ldapsearch to check that slapd is running..."
for i in 0 1 2 3 4 5; do
@ -55,8 +55,8 @@ for i in 0 1 2 3 4 5; do
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for slapd to start..."
sleep 5
echo "Waiting $SLEEP1 seconds for slapd to start..."
sleep $SLEEP1
done
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
@ -84,7 +84,7 @@ if test $WAIT != 0 ; then
fi
KILLPIDS="$KILLPIDS $PID"
sleep 1
sleep $SLEEP0
echo "Using ldapsearch to check that slapd is running..."
for i in 0 1 2 3 4 5; do
@ -94,8 +94,8 @@ for i in 0 1 2 3 4 5; do
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for slapd to start..."
sleep 5
echo "Waiting $SLEEP1 seconds for slapd to start..."
sleep $SLEEP1
done
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
@ -123,7 +123,7 @@ if test $WAIT != 0 ; then
fi
KILLPIDS="$KILLPIDS $PID"
sleep 1
sleep $SLEEP0
echo "Using ldapsearch to check that slapd is running..."
for i in 0 1 2 3 4 5; do
@ -133,8 +133,8 @@ for i in 0 1 2 3 4 5; do
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for slapd to start..."
sleep 5
echo "Waiting $SLEEP1 seconds for slapd to start..."
sleep $SLEEP1
done
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
@ -162,10 +162,14 @@ if test $RC != 0 ; then
fi
echo "Filtering ldapsearch results..."
$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
$LDIFFILTER < data/asyncmeta.closed.out > $LDIFFLT
$LDIFFILTER < $DATADIR/asyncmeta.closed.out > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "Comparison failed - the connections are not closed"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
#run 3 searches
for i in 0 1 2; do
BASEDN="o=Example,c=US"
@ -173,11 +177,6 @@ for i in 0 1 2; do
echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT
$LDAPSEARCH -S "" -H $URI3 -b "$BASEDN" >> $SEARCHOUT 2>&1
RC=$?
#if test $RC != 0 ; then
# echo "Search failed ($RC)!"
# test $KILLSERVERS != no && kill -HUP $KILLPIDS
# exit $RC
#fi
case $RC in
0)
;;
@ -192,15 +191,13 @@ for i in 0 1 2; do
exit $RC
;;
esac
sleep 2
done
# search cn=monitor - no connections should be closed yet
SEARCHDN="cn=Connections,cn=database 1,cn=databases,cn=monitor"
sleep $SLEEP0
echo "Verifying that all target connections are open..."
cat /dev/null > $SEARCHOUT
echo " base=\"$SEARCHDN\"..."
echo "# base=\"$SEARCHDN\"..." >> $SEARCHOUT
$LDAPSEARCH -H $URI3 \
-b "$SEARCHDN" \
'olmTargetConnFlags' >> $SEARCHOUT 2>&1
@ -212,20 +209,27 @@ if test $RC != 0 ; then
fi
echo "Filtering ldapsearch results..."
$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
$LDIFFILTER < data/asyncmeta.allopen.out > $LDIFFLT
$LDIFFILTER < $DATADIR/asyncmeta.allopen.out > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
# wait 6 seconds and search cn=monitor - connection group 1 is closed
if test $? != 0 ; then
echo "Comparison failed - the connections are not open"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
# wait 7 seconds (the con ttl time + 1) and search cn=monitor
# connection group 1 should be closed
echo "Waiting for the time-to-live time..."
sleep $SLEEP1
SEARCHDN="cn=Connections,cn=database 1,cn=databases,cn=monitor"
echo "Verifying that connection group 1 is closed..."
sleep 5
cat /dev/null > $SEARCHOUT
echo " base=\"$SEARCHDN\"..."
echo " base=\"cn=Connection Group 1,$SEARCHDN\"..."
echo "# base=\"$SEARCHDN\"..." >> $SEARCHOUT
$LDAPSEARCH -H $URI3 \
-b "$SEARCHDN" \
-b "cn=Connection Group 1,$SEARCHDN" \
"olmTargetConnFlags=closed" 'olmTargetConnFlags' >> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
@ -235,16 +239,22 @@ if test $RC != 0 ; then
fi
echo "Filtering ldapsearch results..."
$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
$LDIFFILTER < data/asyncmeta.1.out > $LDIFFLT
$LDIFFILTER < $DATADIR/asyncmeta.1.out > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
SEARCHDN="cn=Connections,cn=database 1,cn=databases,cn=monitor"
if test $? != 0 ; then
echo "Comparison failed - connection group 1 is not closed"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
# wait 7 seconds (the con ttl interval + 1) and search cn=monitor
# connection group 2 should be closed
echo "Waiting for the connection reset interval..."
sleep $SLEEP1
echo "Verifying that target connection group 2 is closed..."
sleep 6
cat /dev/null > $SEARCHOUT
echo " base=\"$SEARCHDN\"..."
echo "# base=\"$SEARCHDN\"..." >> $SEARCHOUT
echo " base=\"cn=Connection Group 2,$SEARCHDN\"..."
$LDAPSEARCH -H $URI3 \
-b "cn=Connection Group 2,$SEARCHDN" \
"olmTargetConnFlags=closed" 'olmTargetConnFlags' >> $SEARCHOUT 2>&1
@ -257,33 +267,54 @@ fi
echo "Filtering ldapsearch results..."
$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
$LDIFFILTER < data/asyncmeta.2.out > $LDIFFLT
$LDIFFILTER < $DATADIR/asyncmeta.2.out > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
SEARCHDN="cn=Connections,cn=database 1,cn=databases,cn=monitor"
echo "Verifying that all target connections are closed..."
# wait 6 seconds, search, all connections should be closed
sleep 6
cat /dev/null > $SEARCHOUT
echo " base=\"$SEARCHDN\"..."
echo "# base=\"$SEARCHDN\"..." >> $SEARCHOUT
$LDAPSEARCH -H $URI3 \
-b "$SEARCHDN" \
"olmTargetConnFlags=closed" 'olmTargetConnFlags' >> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "Unable to read monitor ($RC)!"
if test $? != 0 ; then
echo "Comparison failed - connection group 2 is not closed"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
exit 1
fi
echo "Filtering ldapsearch results..."
$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
$LDIFFILTER < data/asyncmeta.closed.out > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
# wait 7 seconds (the con ttl interval + 1) and search cn=monitor
# all connections should be closed
# sometimes the timeout loop may be delayed, so we give it a couple of
# retries before giving up
echo "Waiting for the connection reset interval..."
sleep $SLEEP1
echo "Verifying that all target connections are closed..."
for i in 0 1 2; do
cat /dev/null > $SEARCHOUT
echo " base=\"$SEARCHDN\"..."
echo "# base=\"$SEARCHDN\"..." >> $SEARCHOUT
$LDAPSEARCH -H $URI3 \
-b "$SEARCHDN" \
"olmTargetConnFlags=closed" 'olmTargetConnFlags' >> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "Unable to read monitor ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Filtering ldapsearch results..."
$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
$LDIFFILTER < $DATADIR/asyncmeta.closed.out > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
if test $? != 0 ; then
if test $i != 2 ; then
echo "Comparison failed - the connections are not closed, retrying in $SLEEP0 seconds..."
sleep $SLEEP0
else
echo "Comparison failed - the connections are not closed, test failed"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit 1
fi
else
echo "Comparison successfull, all connections are closed"
break
fi
done
cat /dev/null > $SEARCHOUT
test $KILLSERVERS != no && kill -HUP $KILLPIDS