From 38791abdc983d29fb194e32bdfcccfd2b2d32c5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Thu, 22 Jun 2023 11:23:26 +0100 Subject: [PATCH] ITS#9959 Adjust tests --- tests/data/lloadd/monitor.ldif | 34 ++ tests/data/lloadd/test007-monitor.ldif | 60 +++ tests/data/regressions/its9888/its9888 | 570 +++++++++++++++++++++++++ tests/scripts/lloadd/test004-monitor | 14 +- tests/scripts/lloadd/test007-coherence | 15 +- 5 files changed, 683 insertions(+), 10 deletions(-) create mode 100755 tests/data/regressions/its9888/its9888 diff --git a/tests/data/lloadd/monitor.ldif b/tests/data/lloadd/monitor.ldif index 0811d22a3c..3b733c03de 100644 --- a/tests/data/lloadd/monitor.ldif +++ b/tests/data/lloadd/monitor.ldif @@ -80,6 +80,8 @@ dn: cn=Connection 1,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -90,6 +92,8 @@ dn: cn=Connection 3,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -100,6 +104,8 @@ dn: cn=Connection 2,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -110,6 +116,8 @@ dn: cn=Connection 4,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -166,6 +174,8 @@ dn: cn=Connection 1,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -176,6 +186,8 @@ dn: cn=Connection 3,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -186,6 +198,8 @@ dn: cn=Connection 2,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -196,6 +210,8 @@ dn: cn=Connection 4,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -217,6 +233,8 @@ dn: cn=Connection 5,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -227,6 +245,8 @@ dn: cn=Connection 7,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -237,6 +257,8 @@ dn: cn=Connection 8,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -247,6 +269,8 @@ dn: cn=Connection 9,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -257,6 +281,8 @@ dn: cn=Connection 6,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -267,6 +293,8 @@ dn: cn=Connection 10,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -277,6 +305,8 @@ dn: cn=Connection 11,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -287,6 +317,8 @@ dn: cn=Connection 12,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -297,6 +329,8 @@ dn: cn=Connection 13,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 diff --git a/tests/data/lloadd/test007-monitor.ldif b/tests/data/lloadd/test007-monitor.ldif index eb8deaee21..6c53918534 100644 --- a/tests/data/lloadd/test007-monitor.ldif +++ b/tests/data/lloadd/test007-monitor.ldif @@ -47,6 +47,8 @@ dn: cn=Connection 1,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -57,6 +59,8 @@ dn: cn=Connection 2,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -67,6 +71,8 @@ dn: cn=Connection 3,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -77,6 +83,8 @@ dn: cn=Connection 4,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -132,6 +140,8 @@ dn: cn=Connection 1,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 19 olmCompletedOps: 19 @@ -142,6 +152,8 @@ dn: cn=Connection 2,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -152,6 +164,8 @@ dn: cn=Connection 3,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -162,6 +176,8 @@ dn: cn=Connection 4,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -183,6 +199,8 @@ dn: cn=Connection 5,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -193,6 +211,8 @@ dn: cn=Connection 6,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -203,6 +223,8 @@ dn: cn=Connection 7,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -213,6 +235,8 @@ dn: cn=Connection 8,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -223,6 +247,8 @@ dn: cn=Connection 9,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -233,6 +259,8 @@ dn: cn=Connection 10,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -243,6 +271,8 @@ dn: cn=Connection 11,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -253,6 +283,8 @@ dn: cn=Connection 12,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -263,6 +295,8 @@ dn: cn=Connection 13,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -318,6 +352,8 @@ dn: cn=Connection 1,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 20 olmCompletedOps: 20 @@ -328,6 +364,8 @@ dn: cn=Connection 2,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -338,6 +376,8 @@ dn: cn=Connection 3,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 2 olmCompletedOps: 2 @@ -348,6 +388,8 @@ dn: cn=Connection 4,cn=backend,cn=first,cn=Backend Tiers,cn=Load Balancer,cn=B objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT2@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -369,6 +411,8 @@ dn: cn=Connection 5,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -379,6 +423,8 @@ dn: cn=Connection 6,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -389,6 +435,8 @@ dn: cn=Connection 7,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 5 olmCompletedOps: 5 @@ -399,6 +447,8 @@ dn: cn=Connection 8,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -409,6 +459,8 @@ dn: cn=Connection 9,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn= objectClass: olmBalancerConnection olmConnectionType: regular olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -419,6 +471,8 @@ dn: cn=Connection 10,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -429,6 +483,8 @@ dn: cn=Connection 11,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 1 olmCompletedOps: 1 @@ -439,6 +495,8 @@ dn: cn=Connection 12,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 @@ -449,6 +507,8 @@ dn: cn=Connection 13,cn=server 2,cn=first,cn=Backend Tiers,cn=Load Balancer,cn objectClass: olmBalancerConnection olmConnectionType: bind olmConnectionState: ready +olmConnectionLocalAddress: IP=localhost:port +olmConnectionPeerAddress: IP=localhost:@PORT3@ olmPendingOps: 0 olmReceivedOps: 0 olmCompletedOps: 0 diff --git a/tests/data/regressions/its9888/its9888 b/tests/data/regressions/its9888/its9888 new file mode 100755 index 0000000000..1686a6fe68 --- /dev/null +++ b/tests/data/regressions/its9888/its9888 @@ -0,0 +1,570 @@ +#! /bin/sh +# $OpenLDAP$ +## This work is part of OpenLDAP Software . +## +## Copyright 1998-2022 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 +## . + +echo "running defines.sh" +. $SRCDIR/scripts/defines.sh + +if test $SYNCPROV = syncprovno; then + echo "Syncrepl provider overlay not available, test skipped" + exit 0 +fi + +ITS=9288 + +CFPRO=$TESTDIR/cfpro.d +CFCON=$TESTDIR/cfcon.d + +mkdir -p $TESTDIR $DBDIR1A $DBDIR1B $DBDIR2A $CFPRO $CFCON + +$SLAPPASSWD -g -n >$CONFIGPWF + +if test x"$SYNCMODE" = x ; then + SYNCMODE=ro +fi +case "$SYNCMODE" in + ro) + SYNCTYPE="type=refreshOnly interval=00:00:00:03" + ;; + rp) + SYNCTYPE="type=refreshAndPersist" + ;; + *) + echo "unknown sync mode $SYNCMODE" + exit 1; + ;; +esac + +# +# Test replication of dynamic config with alternate consumer config: +# - start provider +# - start consumer +# - configure over ldap +# - populate over ldap +# - configure syncrepl over ldap +# - retrieve database over ldap and compare against expected results +# + +echo "Starting provider slapd on TCP/IP port $PORT1..." +. $CONFFILTER $BACKEND < $DYNAMICCONF > $CONFLDIF +$SLAPADD -F $CFPRO -n 0 -l $CONFLDIF +$SLAPD -F $CFPRO -h $URI1 -d $LVL > $LOG1 2>&1 & +PROVIDERPID=$! +if test $WAIT != 0 ; then + echo PROVIDERPID $PROVIDERPID + read foo +fi +KILLPIDS="$PROVIDERPID" + +sleep 1 + +echo "Using ldapsearch to check that provider slapd is running..." +for i in 0 1 2 3 4 5; do + $LDAPSEARCH -s base -b "" -H $URI1 \ + 'objectclass=*' > /dev/null 2>&1 + RC=$? + if test $RC = 0 ; then + break + fi + echo "Waiting 5 seconds for slapd to start..." + sleep 5 +done + +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Inserting syncprov overlay on provider..." +if [ "$SYNCPROV" = syncprovmod ]; then + $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF < $TESTOUT 2>&1 +dn: cn=module,cn=config +objectClass: olcModuleList +cn: module +olcModulePath: ../servers/slapd/overlays +olcModuleLoad: syncprov.la +EOF + RC=$? + if test $RC != 0 ; then + echo "ldapadd failed for moduleLoad ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi +fi +read CONFIGPW < $CONFIGPWF +$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <> $TESTOUT 2>&1 +dn: olcOverlay=syncprov,olcDatabase={0}config,cn=config +changetype: add +objectClass: olcOverlayConfig +objectClass: olcSyncProvConfig +olcOverlay: syncprov +EOF +RC=$? +if test $RC != 0 ; then + echo "ldapmodify failed for syncprov config ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +# Consumers will not replicate the provider's actual cn=config. +# Instead, they will use an alternate DB so that they may be +# configured differently from the provider. This alternate DB +# will also be a consumer for the real cn=schema,cn=config tree. +# It has multi-provider enabled so that it can be written directly +# while being a consumer of the main schema. +echo "Configuring consumer config DB on provider..." +$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <> $TESTOUT 2>&1 +dn: cn=config +changetype: modify +add: olcServerID +olcServerID: 1 + +dn: olcDatabase={1}ldif,cn=config +changetype: add +objectClass: olcDatabaseConfig +objectClass: olcLdifConfig +olcDatabase: {1}ldif +olcDbDirectory: $DBDIR1A +olcSuffix: cn=config,cn=consumer +olcRootDN: cn=config,cn=consumer +olcRootPW: repsecret +olcAccess: to * by dn.base="cn=config" write + +dn: olcOverlay=syncprov,olcDatabase={1}ldif,cn=config +changetype: add +objectClass: olcOverlayConfig +objectClass: olcSyncProvConfig +olcOverlay: syncprov + +dn: cn=config,cn=consumer +changetype: add +objectClass: olcGlobal +cn: config + +dn: olcDatabase={0}config,cn=config,cn=consumer +changetype: add +objectClass: olcDatabaseConfig +olcDatabase: {0}config +olcRootPW: topsecret +olcSyncrepl: {0}rid=001 provider=$URI1 binddn="cn=config,cn=consumer" + bindmethod=simple credentials=repsecret searchbase="cn=config,cn=consumer" + $SYNCTYPE retry="3 +" timeout=3 suffixmassage="cn=config" +olcUpdateRef: $URI1 + +dn: olcDatabase={1}ldif,cn=config +changetype: modify +add: olcSyncrepl +olcSyncrepl: {0}rid=001 provider=$URI1 binddn="cn=config" + bindmethod=simple credentials=$CONFIGPW searchbase="cn=schema,cn=config" + $SYNCTYPE retry="3 +" timeout=3 + suffixmassage="cn=schema,cn=config,cn=consumer" +- +add: olcMultiProvider +olcMultiProvider: TRUE + +EOF +RC=$? +if test $RC != 0 ; then + echo "ldapmodify failed for consumer DB config ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Starting consumer slapd on TCP/IP port $PORT2..." +$SLAPADD -F $CFCON -n 0 -l $CONFLDIF +$SLAPD -F $CFCON -h $URI2 -d $LVL > $LOG2 2>&1 & +CONSUMERPID=$! +if test $WAIT != 0 ; then + echo CONSUMERPID $CONSUMERPID + read foo +fi +KILLPIDS="$KILLPIDS $CONSUMERPID" + +sleep 1 + +echo "Using ldapsearch to check that consumer slapd is running..." +for i in 0 1 2 3 4 5; do + $LDAPSEARCH -s base -b "" -H $URI2 \ + 'objectclass=*' > /dev/null 2>&1 + RC=$? + if test $RC = 0 ; then + break + fi + echo "Waiting 5 seconds for slapd to start..." + sleep 5 +done + +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Configuring syncrepl on consumer..." +$LDAPMODIFY -D cn=config -H $URI2 -y $CONFIGPWF <>$TESTOUT 2>&1 +dn: olcDatabase={0}config,cn=config +changetype: modify +add: olcSyncRepl +olcSyncRepl: rid=001 provider=$URI1 binddn="cn=config,cn=consumer" + bindmethod=simple credentials=repsecret searchbase="cn=config,cn=consumer" + $SYNCTYPE retry="3 +" timeout=3 + suffixmassage="cn=config" +- +add: olcUpdateRef +olcUpdateRef: $URI1 +EOF + +sleep 1 + +echo "Using ldapsearch to check that syncrepl received config changes..." +RC=32 +for i in 0 1 2 3 4 5; do + RESULT=`$LDAPSEARCH -H $URI2 -D cn=config -y $CONFIGPWF \ + -s base -b "olcDatabase={0}config,cn=config" \ + '(olcUpdateRef=*)' 2>&1 | awk '/^dn:/ {print "OK"}'` + if test "x$RESULT" = "xOK" ; then + RC=0 + break + fi + echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." + sleep $SLEEP1 +done + +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Adding schema and databases on provider..." +$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <>$TESTOUT 2>&1 +include: file://$ABS_SCHEMADIR/core.ldif + +include: file://$ABS_SCHEMADIR/cosine.ldif + +include: file://$ABS_SCHEMADIR/inetorgperson.ldif + +include: file://$ABS_SCHEMADIR/openldap.ldif + +include: file://$ABS_SCHEMADIR/nis.ldif +EOF +RC=$? +if test $RC != 0 ; then + echo "ldapadd failed for schema config ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Using ldapsearch to check that syncrepl received the schema changes..." +RC=32 +for i in 0 1 2 3 4 5; do + RESULT=`$LDAPSEARCH -H $URI2 -D cn=config -y $CONFIGPWF \ + -s sub -b "cn=schema,cn=config" \ + '(cn=*openldap)' 2>&1 | awk '/^dn:/ {print "OK"}'` + if test "x$RESULT" = "xOK" ; then + RC=0 + break + fi + echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." + sleep $SLEEP1 +done + +nullExclude="" nullOK="" +test $BACKEND = null && nullExclude="# " nullOK="OK" + +if [ "$BACKENDTYPE" = mod ]; then + $LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <>$TESTOUT 2>&1 +dn: cn=module,cn=config +objectClass: olcModuleList +cn: module +olcModulePath: ../servers/slapd/back-$BACKEND +olcModuleLoad: back_$BACKEND.la + +dn: cn=module,cn=config,cn=consumer +objectClass: olcModuleList +cn: module +olcModulePath: ../servers/slapd/back-$BACKEND +olcModuleLoad: back_$BACKEND.la +EOF + RC=$? + if test $RC != 0 ; then + echo "ldapadd failed for backend config ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi +fi + +$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <>$TESTOUT 2>&1 +dn: olcDatabase={2}$BACKEND,cn=config +objectClass: olcDatabaseConfig +${nullExclude}objectClass: olc${BACKEND}Config +olcDatabase: {2}$BACKEND +olcSuffix: $BASEDN +${nullExclude}olcDbDirectory: $DBDIR1B +olcRootDN: $MANAGERDN +olcRootPW: $PASSWD +olcSyncRepl: rid=002 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple + credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE + retry="3 +" timeout=3 +olcUpdateRef: $URI1 + +dn: olcOverlay=syncprov,olcDatabase={2}${BACKEND},cn=config +changetype: add +objectClass: olcOverlayConfig +objectClass: olcSyncProvConfig +olcOverlay: syncprov + +dn: olcDatabase={1}$BACKEND,cn=config,cn=consumer +objectClass: olcDatabaseConfig +${nullExclude}objectClass: olc${BACKEND}Config +olcDatabase: {1}$BACKEND +olcSuffix: $BASEDN +${nullExclude}olcDbDirectory: $DBDIR2A +olcRootDN: $MANAGERDN +olcRootPW: $PASSWD +olcSyncRepl: rid=002 provider=$URI1 binddn="$MANAGERDN" bindmethod=simple + credentials=$PASSWD searchbase="$BASEDN" $SYNCTYPE + retry="3 +" timeout=3 +olcUpdateRef: $URI1 + +EOF +RC=$? +if test $RC != 0 ; then + echo "ldapadd failed for database config ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +if test $INDEXDB = indexdb ; then + $LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <>$TESTOUT 2>&1 +dn: olcDatabase={2}$BACKEND,cn=config +changetype: modify +add: olcDbIndex +olcDbIndex: objectClass,entryUUID,entryCSN eq +olcDbIndex: cn,uid pres,eq,sub +EOF + RC=$? + if test $RC != 0 ; then + echo "ldapadd modify for database config ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + fi +fi + +echo "Using ldapadd to populate provider..." +$LDAPADD -D "$MANAGERDN" -H $URI1 -w $PASSWD -f $LDIFORDERED \ + >> $TESTOUT 2>&1 +RC=$? +if test $RC != 0 ; then + echo "ldapadd failed for database config ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." +sleep $SLEEP1 + +echo "Using ldapsearch to check that syncrepl received database changes..." +RC=32 +for i in 0 1 2 3 4 5; do + RESULT=`$LDAPSEARCH -H $URI2 \ + -s base -b "cn=Ursula Hampster,ou=Alumni Association,ou=People,dc=example,dc=com" \ + '(objectClass=*)' 2>&1 | awk '/^dn:/ {print "OK"}'` + if test "x$RESULT$nullOK" = "xOK" ; then + RC=0 + break + fi + echo "Waiting $SLEEP1 seconds for syncrepl to receive changes..." + sleep $SLEEP1 +done + +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Using ldapsearch to read all the entries from the provider..." +$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI1 -w $PASSWD \ + '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" -D "$MANAGERDN" -H $URI2 -w $PASSWD \ + '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 + +echo "Filtering provider results..." +$LDIFFILTER < $PROVIDEROUT > $PROVIDERFLT +echo "Filtering consumer results..." +$LDIFFILTER < $CONSUMEROUT > $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" + exit 1 +fi + +echo "Stopping provider and consumer" + +kill -HUP $KILLPIDS + +sleep 3 + +echo "Exporting config database for consumer from provider" +$SLAPCAT -o ldif-wrap=no -F testrun/cfpro.d -b "cn=config,cn=consumer" -l testrun/config-consumer.ldif +echo "Rewriting config database for loading on consumer" +cp testrun/config-consumer.ldif testrun/consumer.ldif +sed -i -e "s/^dn:\(.*\),cn=consumer/dn:\1/" testrun/consumer.ldif +mv $CFCON $CFCON.orig +mkdir -p $CFCON +echo "Reloading config database on consumer" +$SLAPADD -F $CFCON -n 0 -l testrun/consumer.ldif + +echo "Restarting consumer slapd on TCP/IP port $PORT2..." +$SLAPD -F $CFCON -h $URI2 -d $LVL >> $LOG2 2>&1 & +CONSUMERPID=$! +if test $WAIT != 0 ; then + echo CONSUMERPID $CONSUMERPID + read foo +fi +KILLPIDS="$CONSUMERPID" + +sleep 1 + +echo "Using ldapsearch to check that consumer slapd is running..." +for i in 0 1 2 3 4 5; do + $LDAPSEARCH -s base -b "" -H $URI2 \ + 'objectclass=*' > /dev/null 2>&1 + RC=$? + if test $RC = 0 ; then + break + fi + echo "Waiting 5 seconds for slapd to start..." + sleep 5 +done + +if test $RC != 0 ; then + echo "ldapsearch failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC +fi + +echo "Updating timestamps on provider version of consumer config database" +timestamp=`date --utc +"%Y%m%d%H%M%S.%6NZ"` + +newcsn="${timestamp}#000000#001#000000" + +sed -i -e "s/entryCSN:.*/entryCSN: $newcsn/" testrun/config-consumer.ldif +sed -i -e 's/contextCSN: .*#001#.*/contextCSN: 20230724180831.311873Z#000000#001#000000/' testrun/config-consumer.ldif + +mv testrun/db.1.a testrun/db.1.a.orig +mkdir -p testrun/db.1.a + +$SLAPADD -F $CFPRO -b "cn=config,cn=consumer" -l testrun/config-consumer.ldif + +echo "Restarting provider slapd on TCP/IP port $PORT1..." +$SLAPD -F $CFPRO -h $URI1 -d $LVL >> $LOG1 2>&1 & +PROVIDERPID=$! +if test $WAIT != 0 ; then + echo PROVIDERPID $PROVIDERPID + read foo +fi +KILLPIDS="$KILLPIDS $PROVIDERPID" + +echo "Waiting for consumer to refresh..." +sleep 7 + +echo "Checking contextCSN values for replicated cn=config..." + +CSN_ERRORS=0 +CSN1=`$LDAPSEARCH -x -D "cn=config,cn=consumer" -w "repsecret" -H $URI1 -b "cn=config,cn=consumer" -s base contextCSN | grep contextCSN | sort` +CSN2=`$LDAPSEARCH -x -D "cn=config" -w "topsecret" -H $URI2 -b "cn=config" -s base contextCSN | grep contextCSN | sort` + +if test -z "$CSN1" ; then + echo "ERROR: contextCSN missing on the provider version of the consumer config" + exit 1 +fi + +if test -z "$CSN2" ; then + echo "ERROR: contextCSN missing on the consumer config database" + exit 1 +fi + +nCSN=`echo "$CSN1" | wc -l` +if test "$nCSN" -ne 2 ; then + echo "ERROR: Wrong contextCSN count on provider, should be 2" + exit 1 +fi + +nCSN=`echo "$CSN2" | wc -l` +if test "$nCSN" -ne 2 ; then + echo "ERROR: Wrong contextCSN count on consumer, should be 2" + exit 1 +fi +if test -z "$CSN2" -o "$CSN1" != "$CSN2" ; then + echo "ERROR: contextCSN mismatch between provider and consumer" + echo "contextCSN on provider:" + echo "$CSN1" + echo "contextCSN on consumer:" + echo "$CSN2" + exit 1 +fi + +echo "Using ldapsearch to read all the entries from the consumer..." +$LDAPSEARCH -S "" -b "$BASEDN" -D "$MANAGERDN" -H $URI2 -w $PASSWD \ + '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..." +$LDIFFILTER < $PROVIDEROUT > $PROVIDERFLT +echo "Filtering consumer results..." +$LDIFFILTER < $CONSUMEROUT > $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" + exit 1 +fi + +echo ">>>>> Test succeeded" + +test $KILLSERVERS != no && wait + +exit 0 diff --git a/tests/scripts/lloadd/test004-monitor b/tests/scripts/lloadd/test004-monitor index ef308b28e5..a70f275c3a 100755 --- a/tests/scripts/lloadd/test004-monitor +++ b/tests/scripts/lloadd/test004-monitor @@ -344,12 +344,16 @@ test $KILLSERVERS != no && kill -HUP $KILLPIDS LDIF=$DATADIR/lloadd/monitor.ldif echo "Filtering ldapsearch results..." -$LDIFFILTER -s e < $SEARCHOUT > $SEARCHFLT +$LDIFFILTER -s e < $SEARCHOUT | \ + sed \ + -e '/^olmConnectionLocalAddress:/s/:[0-9]*$/:port/' \ + -e '/^olmConnectionLocalAddress:/s/IP=127\.0\.0\.1:/IP=localhost:/' \ + -e '/^olmConnectionLocalAddress:/s/IP=\[::1\]:/IP=localhost:/' \ + -e '/^olmConnectionPeerAddress:/s/IP=127\.0\.0\.1:/IP=localhost:/' \ + -e '/^olmConnectionPeerAddress:/s/IP=\[::1\]:/IP=localhost:/' \ + > $SEARCHFLT echo "Filtering original ldif used to create database..." -$LDIFFILTER -s e < $LDIF | sed \ - -e "s|@URI2@|$URI2|g" \ - -e "s|@URI3@|$URI3|g" \ - > $LDIFFLT +$LDIFFILTER -s e < $LDIF | . $CONFFILTER $BACKEND > $LDIFFLT echo "Comparing filter output..." $CMP $SEARCHFLT $LDIFFLT > $CMPOUT diff --git a/tests/scripts/lloadd/test007-coherence b/tests/scripts/lloadd/test007-coherence index cda6deac7d..fab08be93f 100755 --- a/tests/scripts/lloadd/test007-coherence +++ b/tests/scripts/lloadd/test007-coherence @@ -487,12 +487,17 @@ echo "Filtering ldapsearch results..." # For now, we don't make sure olmIncomingConnections is reflective of current # state (=no connections open) since olmIncomingConnections can be != 0 for a # second after it's closed -$LDIFFILTER < $SEARCHOUT | grep -v '^olmIncomingConnections:' > $SEARCHFLT +$LDIFFILTER < $SEARCHOUT | \ + grep -v '^olmIncomingConnections:' | \ + sed \ + -e '/^olmConnectionLocalAddress:/s/:[0-9]*$/:port/' \ + -e '/^olmConnectionLocalAddress:/s/IP=127\.0\.0\.1:/IP=localhost:/' \ + -e '/^olmConnectionLocalAddress:/s/IP=\[::1\]:/IP=localhost:/' \ + -e '/^olmConnectionPeerAddress:/s/IP=127\.0\.0\.1:/IP=localhost:/' \ + -e '/^olmConnectionPeerAddress:/s/IP=\[::1\]:/IP=localhost:/' \ + > $SEARCHFLT echo "Filtering original ldif used to create database..." -$LDIFFILTER < $LDIF | sed \ - -e "s|@URI2@|$URI2|g" \ - -e "s|@URI3@|$URI3|g" \ - > $LDIFFLT +$LDIFFILTER < $LDIF | . $CONFFILTER $BACKEND > $LDIFFLT echo "Comparing filter output..." $CMP $SEARCHFLT $LDIFFLT > $CMPOUT -- 2.47.3