mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-12 15:10:31 +08:00
ITS#9823 Update test043 to check deltasync recovery after accesslog has been purged
This commit is contained in:
parent
926bf389d9
commit
e56e70b414
@ -29,6 +29,10 @@ argsfile @TESTDIR@/slapd.1.args
|
||||
#accesslogmod#modulepath ../servers/slapd/overlays/
|
||||
#accesslogmod#moduleload accesslog.la
|
||||
|
||||
database config
|
||||
include @TESTDIR@/configpw.conf
|
||||
|
||||
|
||||
#######################################################################
|
||||
# provider database definitions
|
||||
#######################################################################
|
||||
|
@ -34,6 +34,8 @@ mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR2
|
||||
|
||||
SPEC="mdb=a"
|
||||
|
||||
$SLAPPASSWD -g -n >$CONFIGPWF
|
||||
echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf
|
||||
#
|
||||
# Test replication:
|
||||
# - start provider
|
||||
@ -129,6 +131,7 @@ sleep $SLEEP1
|
||||
|
||||
echo "Stopping the provider, sleeping 10 seconds and restarting it..."
|
||||
kill -HUP "$PID"
|
||||
wait $PID
|
||||
sleep 10
|
||||
echo "RESTART" >> $LOG1
|
||||
$SLAPD -f $CONF1 -h $URI1 -d $LVL >> $LOG1 2>&1 &
|
||||
@ -296,7 +299,8 @@ fi
|
||||
|
||||
echo "Stopping consumer to test recovery..."
|
||||
kill -HUP $CONSUMERPID
|
||||
sleep 10
|
||||
wait $CONSUMERPID
|
||||
KILLPIDS="$PID"
|
||||
|
||||
echo "Modifying more entries on the provider..."
|
||||
$LDAPMODIFY -v -D "$BJORNSDN" -H $URI1 -w bjorn >> \
|
||||
@ -388,6 +392,131 @@ if test $RC != 0 ; then
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Filtering provider results..."
|
||||
$LDIFFILTER -b $BACKEND -s $SPEC < $PROVIDEROUT | grep -iv "^auditcontext:" > $PROVIDERFLT
|
||||
echo "Filtering consumer results..."
|
||||
$LDIFFILTER -b $BACKEND -s $SPEC < $CONSUMEROUT | grep -iv "^auditcontext:" > $CONSUMERFLT
|
||||
|
||||
echo "Comparing retrieved entries from provider and consumer..."
|
||||
$CMP $PROVIDERFLT $CONSUMERFLT > $CMPOUT
|
||||
|
||||
if test $? != 0 ; then
|
||||
echo "test failed - provider and consumer databases differ"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Stopping consumer to test recovery after logpurge expired..."
|
||||
kill -HUP $CONSUMERPID
|
||||
wait $CONSUMERPID
|
||||
KILLPIDS="$PID"
|
||||
|
||||
echo "Modifying even more entries on the provider..."
|
||||
$LDAPMODIFY -v -D "$BJORNSDN" -H $URI1 -w bjorn >> \
|
||||
$TESTOUT 2>&1 << EOMODS
|
||||
dn: cn=Dorothy Stevens,ou=Alumni Association,ou=People,dc=example,dc=com
|
||||
changetype: delete
|
||||
|
||||
dn: cn=Bjorn Jensen, ou=Information Technology Division, ou=People, dc=example,dc=com
|
||||
changetype: modify
|
||||
add: drink
|
||||
drink: Sangria
|
||||
|
||||
dn: cn=George D. Stevens, ou=Retired, ou=People, dc=example,dc=com
|
||||
changetype: add
|
||||
objectclass: OpenLDAPperson
|
||||
sn: Stevens
|
||||
uid: gstevens
|
||||
cn: George D. Stevens
|
||||
|
||||
dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,dc=example,
|
||||
dc=com
|
||||
changetype: modify
|
||||
replace: drink
|
||||
drink: cold water
|
||||
|
||||
dn: cn=Some Staff,ou=Groups,dc=example,dc=com
|
||||
changetype: modrdn
|
||||
newrdn: cn=More Staff
|
||||
deleteoldrdn: 1
|
||||
|
||||
EOMODS
|
||||
|
||||
echo "Configuring logpurge of 1 second..."
|
||||
$LDAPMODIFY -v -D cn=config -H $URI1 -y $CONFIGPWF >> \
|
||||
$TESTOUT 2>&1 << EOMODS
|
||||
|
||||
dn: olcOverlay={1}accesslog,olcDatabase={2}$BACKEND,cn=config
|
||||
changetype: modify
|
||||
replace: olcAccessLogPurge
|
||||
olcAccessLogPurge: 0+00:00:02 0+00:00:01
|
||||
-
|
||||
|
||||
EOMODS
|
||||
RC=$?
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapmodify failed ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Waiting 4 seconds for accesslog to be purged..."
|
||||
sleep 4
|
||||
|
||||
echo "Using ldapsearch to check if accesslog is empty..."
|
||||
for i in 0 1 2 3 4 5; do
|
||||
$LDAPSEARCH -b "cn=log" -H $URI1 -z 1 \
|
||||
> $SEARCHOUT 2>&1
|
||||
RC=$?
|
||||
if test $RC = 0 ; then
|
||||
break
|
||||
fi
|
||||
echo "Waiting 3 seconds for accesslog to be purged..."
|
||||
sleep 3
|
||||
done
|
||||
|
||||
if test $RC != 0; then
|
||||
echo "Accesslog did not purge in time"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "Restarting consumer..."
|
||||
echo "RESTART" >> $LOG2
|
||||
$SLAPD -f $CONF2 -h $URI2 -d $LVL >> $LOG2 2>&1 &
|
||||
CONSUMERPID=$!
|
||||
if test $WAIT != 0 ; then
|
||||
echo CONSUMERPID $CONSUMERPID
|
||||
read foo
|
||||
fi
|
||||
KILLPIDS="$PID $CONSUMERPID"
|
||||
|
||||
echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..."
|
||||
sleep $SLEEP1
|
||||
|
||||
echo "Using ldapsearch to read all the entries from the provider..."
|
||||
$LDAPSEARCH -S "" -b "$BASEDN" -H $URI1 \
|
||||
'objectclass=*' \* + > $PROVIDEROUT 2>&1
|
||||
RC=$?
|
||||
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed at provider ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
echo "Using ldapsearch to read all the entries from the consumer..."
|
||||
$LDAPSEARCH -S "" -b "$BASEDN" -H $URI2 \
|
||||
'objectclass=*' \* + > $CONSUMEROUT 2>&1
|
||||
RC=$?
|
||||
|
||||
if test $RC != 0 ; then
|
||||
echo "ldapsearch failed at consumer ($RC)!"
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
exit $RC
|
||||
fi
|
||||
|
||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||
|
||||
echo "Filtering provider results..."
|
||||
|
Loading…
x
Reference in New Issue
Block a user