-echo " base=\"cn=Connection Group 1,$SEARCHDN\"..."
-echo "# base=\"$SEARCHDN\"..." >> $SEARCHOUT
-$LDAPSEARCH -H $URI3 \
- -b "cn=Connection Group 1,$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.1.out > $LDIFFLT
-echo "Comparing filter output..."
-$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
-if test $? != 0 ; then
- echo "Comparison failed - connection group 1 is not closed"
- test $KILLSERVERS != no && kill -HUP $KILLPIDS
- exit 1
-fi
+ echo " base=\"cn=Connection Group 1,$SEARCHDN\"..."
+ echo "# base=\"$SEARCHDN\"..." >> $SEARCHOUT
+ $LDAPSEARCH -H $URI3 \
+ -b "cn=Connection Group 1,$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.1.out > $LDIFFLT
+ echo "Comparing filter output..."
+ $CMP $SEARCHFLT $LDIFFLT > $CMPOUT
+ if test $? != 0 ; then
+ if test $i != 2 ; then
+ echo "Comparison failed - connection group 1 is not closed, retrying in $SLEEP0 seconds..."
+ sleep $SLEEP0
+ else
+ echo "Comparison failed - connection group 1 is not closed, test failed"
+ test $KILLSERVERS != no && kill -HUP $KILLPIDS
+ exit 1
+ fi
+ else
+ echo "Comparison successful, all connections are closed"
+ break
+ fi
+done