From 44276337773fce170b52ce70e504dfab9b7816e9 Mon Sep 17 00:00:00 2001
From: Pierangelo Masarati <ando@openldap.org>
Date: Mon, 26 Jul 2004 13:45:28 +0000
Subject: [PATCH] misc cleanup and improvements; please use @URIx@ and @PORTx@
 in configurations/tests

---
 tests/data/relay.out                          | 27 ++++++++++---------
 tests/data/slapd-glue.conf                    |  4 +++
 tests/data/slapd-proxycache.conf              |  2 +-
 tests/data/slapd-ref-slave.conf               |  2 +-
 tests/data/slapd-repl-master.conf             |  2 +-
 tests/data/slapd-syncrepl-slave-persist1.conf |  2 +-
 tests/data/slapd-syncrepl-slave-persist2.conf |  2 +-
 tests/data/slapd-syncrepl-slave-persist3.conf |  2 +-
 tests/data/slapd-syncrepl-slave-refresh1.conf |  2 +-
 tests/data/slapd-syncrepl-slave-refresh2.conf |  2 +-
 tests/scripts/conf.sh                         |  9 +++++++
 tests/scripts/defines.sh                      | 13 ++++-----
 tests/scripts/test021-certificate             |  2 +-
 tests/scripts/test030-relay                   | 14 +++++-----
 14 files changed, 51 insertions(+), 34 deletions(-)

diff --git a/tests/data/relay.out b/tests/data/relay.out
index 3d545eaa32..9df706233b 100644
--- a/tests/data/relay.out
+++ b/tests/data/relay.out
@@ -2051,28 +2051,31 @@ dn: ou=Referrals,dc=example,dc=com
 objectClass: referral
 objectClass: extensibleObject
 ou: Referrals
-description: Just added as ldap://localhost:9011/ou=Referrals,o=Beispiel,c=DE
-description: ...and modified as ldap://localhost:9012/ou=Referrals,o=Beispiel,
- c=DE
-ref: ldap://localhost:9012/ou=Referrals,dc=example,dc=com??base
+description: Just added as ldap://localhost.localdomain/ou=Referrals,o=Beispie
+ l,c=DE
+description: ...and modified as ldap://ldap.example.com/ou=Referrals,o=Beispie
+ l,c=DE
+ref: ldap://ldap.example.com:389/ou=Referrals,dc=example,dc=com??base
 
 dn: ou=Referrals,o=Example,c=US
 objectClass: referral
 objectClass: extensibleObject
 ou: Referrals
-description: Just added as ldap://localhost:9011/ou=Referrals,o=Beispiel,c=DE
-description: ...and modified as ldap://localhost:9012/ou=Referrals,o=Beispiel,
- c=DE
-ref: ldap://localhost:9012/ou=Referrals,o=Example,c=US??base
+description: Just added as ldap://localhost.localdomain/ou=Referrals,o=Beispie
+ l,c=DE
+description: ...and modified as ldap://ldap.example.com/ou=Referrals,o=Beispie
+ l,c=DE
+ref: ldap://ldap.example.com:389/ou=Referrals,o=Example,c=US??base
 
 dn: ou=Referrals,o=Esempio,c=IT
 objectClass: referral
 objectClass: extensibleObject
 ou: Referrals
-description: Just added as ldap://localhost:9011/ou=Referrals,o=Beispiel,c=DE
-description: ...and modified as ldap://localhost:9012/ou=Referrals,o=Beispiel,
- c=DE
-ref: ldap://localhost:9012/ou=Referrals,o=Esempio,c=IT??base
+description: Just added as ldap://localhost.localdomain/ou=Referrals,o=Beispie
+ l,c=DE
+description: ...and modified as ldap://ldap.example.com/ou=Referrals,o=Beispie
+ l,c=DE
+ref: ldap://ldap.example.com:389/ou=Referrals,o=Esempio,c=IT??base
 
 dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,o=Example,c
  =US
diff --git a/tests/data/slapd-glue.conf b/tests/data/slapd-glue.conf
index e3a855018d..d62ad66e3d 100644
--- a/tests/data/slapd-glue.conf
+++ b/tests/data/slapd-glue.conf
@@ -25,6 +25,8 @@ argsfile    ./testrun/slapd.1.args
 #mod#modulepath	../servers/slapd/back-@BACKEND@/
 #mod#moduleload	back_@BACKEND@.la
 
+#monitormod#moduleload ../servers/slapd/back-monitor/back_monitor.la
+
 #######################################################################
 # ldbm database definitions
 #######################################################################
@@ -70,3 +72,5 @@ rootpw		secret
 #bdb#index		objectclass	eq
 #bdb#index		uid	pres,eq,sub
 #bdb#index		cn,sn	pres,eq,sub,subany
+
+#monitor#database monitor
diff --git a/tests/data/slapd-proxycache.conf b/tests/data/slapd-proxycache.conf
index 22abafe437..5336c36765 100644
--- a/tests/data/slapd-proxycache.conf
+++ b/tests/data/slapd-proxycache.conf
@@ -35,7 +35,7 @@ argsfile    ./testrun/slapd.2.args
 database	ldap
 suffix          "dc=example,dc=com"
 rootdn          "dc=example,dc=com"
-uri		ldap://127.0.0.1:9011/
+uri		"@URI1@"
 
 overlay proxycache
 proxycache	@BACKEND@ 100 2 @ENTRY_LIMIT@ @CACHETTL@
diff --git a/tests/data/slapd-ref-slave.conf b/tests/data/slapd-ref-slave.conf
index d85dea3e57..6e12082d3c 100644
--- a/tests/data/slapd-ref-slave.conf
+++ b/tests/data/slapd-ref-slave.conf
@@ -30,7 +30,7 @@ argsfile    ./testrun/slapd.2.args
 # ldbm database definitions
 #######################################################################
 
-referral	"ldap://localhost:9011/"
+referral	"@URI1@"
 
 database	@BACKEND@
 cachesize	0
diff --git a/tests/data/slapd-repl-master.conf b/tests/data/slapd-repl-master.conf
index aacb04bf1b..b8e5059326 100644
--- a/tests/data/slapd-repl-master.conf
+++ b/tests/data/slapd-repl-master.conf
@@ -43,7 +43,7 @@ rootpw		secret
 
 replogfile	./testrun/slapd.1.replog
 
-replica		host=localhost:9012
+replica		host=localhost:@PORT2@
 		binddn="cn=Replica,dc=example,dc=com"
 		bindmethod=simple
 		credentials=secret
diff --git a/tests/data/slapd-syncrepl-slave-persist1.conf b/tests/data/slapd-syncrepl-slave-persist1.conf
index 412dd3aa25..4ac6c7510d 100644
--- a/tests/data/slapd-syncrepl-slave-persist1.conf
+++ b/tests/data/slapd-syncrepl-slave-persist1.conf
@@ -42,7 +42,7 @@ rootpw		secret
 
 # Don't change syncrepl spec yet
 syncrepl rid=1
-		 provider=ldap://localhost:9011
+		 provider=@URI1@
 		 updatedn="cn=Replica,dc=example,dc=com"
 		 binddn="cn=Manager,dc=example,dc=com"
 		 bindmethod=simple
diff --git a/tests/data/slapd-syncrepl-slave-persist2.conf b/tests/data/slapd-syncrepl-slave-persist2.conf
index e4d75e9e39..0ce38a380f 100644
--- a/tests/data/slapd-syncrepl-slave-persist2.conf
+++ b/tests/data/slapd-syncrepl-slave-persist2.conf
@@ -30,7 +30,7 @@ rootpw		secret
 
 # Don't change syncrepl spec yet
 syncrepl rid=1
-		 provider=ldap://localhost:9014
+		 provider=@URI4@
 		 updatedn="cn=Replica,dc=example,dc=com"
 		 binddn="cn=Replica,dc=example,dc=com"
 		 bindmethod=simple
diff --git a/tests/data/slapd-syncrepl-slave-persist3.conf b/tests/data/slapd-syncrepl-slave-persist3.conf
index 940ac09e61..4c1bdb557a 100644
--- a/tests/data/slapd-syncrepl-slave-persist3.conf
+++ b/tests/data/slapd-syncrepl-slave-persist3.conf
@@ -42,7 +42,7 @@ rootpw		secret
 
 # Don't change syncrepl spec yet
 syncrepl rid=1
-		 provider=ldap://localhost:9011
+		 provider=@URI1@
 		 updatedn="cn=Replica,dc=example,dc=com"
 		 binddn="cn=Manager,dc=example,dc=com"
 		 bindmethod=simple
diff --git a/tests/data/slapd-syncrepl-slave-refresh1.conf b/tests/data/slapd-syncrepl-slave-refresh1.conf
index 575b15538f..e7f8cb0eaa 100644
--- a/tests/data/slapd-syncrepl-slave-refresh1.conf
+++ b/tests/data/slapd-syncrepl-slave-refresh1.conf
@@ -44,7 +44,7 @@ sessionlog 1 100
 
 # Don't change syncrepl spec yet
 syncrepl rid=1
-		 provider=ldap://localhost:9011
+		 provider=@URI1@
 		 updatedn="cn=Replica,dc=example,dc=com"
 		 binddn="cn=Manager,dc=example,dc=com"
 		 bindmethod=simple
diff --git a/tests/data/slapd-syncrepl-slave-refresh2.conf b/tests/data/slapd-syncrepl-slave-refresh2.conf
index 30f4453b06..5edd50a383 100644
--- a/tests/data/slapd-syncrepl-slave-refresh2.conf
+++ b/tests/data/slapd-syncrepl-slave-refresh2.conf
@@ -42,7 +42,7 @@ rootpw		secret
 
 # Don't change syncrepl spec yet
 syncrepl rid=1
-		 provider=ldap://localhost:9012
+		 provider=@URI2@
 		 updatedn="cn=Replica,dc=example,dc=com"
 		 binddn="cn=Replica,dc=example,dc=com"
 		 bindmethod=simple
diff --git a/tests/scripts/conf.sh b/tests/scripts/conf.sh
index 23b9e96978..9d7609d632 100755
--- a/tests/scripts/conf.sh
+++ b/tests/scripts/conf.sh
@@ -48,6 +48,15 @@ sed -e "s/@BACKEND@/${BACKEND}/"			\
 	-e "s;@URI1@;${URI1};"	\
 	-e "s;@URI2@;${URI2};"	\
 	-e "s;@URI3@;${URI3};"	\
+	-e "s;@URI4@;${URI4};"	\
+	-e "s;@URI5@;${URI5};"	\
+	-e "s;@URI6@;${URI6};"	\
+	-e "s;@PORT1@;${PORT1};"	\
+	-e "s;@PORT2@;${PORT2};"	\
+	-e "s;@PORT3@;${PORT3};"	\
+	-e "s;@PORT4@;${PORT4};"	\
+	-e "s;@PORT5@;${PORT5};"	\
+	-e "s;@PORT6@;${PORT6};"	\
 	-e "s/@SASL_MECH@/${SASL_MECH}/"	\
 	-e "s/@CACHETTL@/${CACHETTL}/"			\
 	-e "s/@ENTRY_LIMIT@/${CACHE_ENTRY_LIMIT}/"   
diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh
index ec50ee8ddd..a1b359defb 100755
--- a/tests/scripts/defines.sh
+++ b/tests/scripts/defines.sh
@@ -113,12 +113,13 @@ LDAPCOMPARE="$CLIENTDIR/ldapcompare $TOOLARGS"
 SLAPDTESTER=$PROGDIR/slapd-tester
 LVL=${SLAPD_DEBUG-261}
 LOCALHOST=localhost
-PORT1=9011
-PORT2=9012
-PORT3=9013
-PORT4=9014
-PORT5=9015
-PORT6=9016
+BASEPORT=${SLAPD_BASEPORT-9010}
+PORT1=`expr $BASEPORT + 1`
+PORT2=`expr $BASEPORT + 2`
+PORT3=`expr $BASEPORT + 3`
+PORT4=`expr $BASEPORT + 4`
+PORT5=`expr $BASEPORT + 5`
+PORT6=`expr $BASEPORT + 6`
 URI1="ldap://${LOCALHOST}:$PORT1/"
 URI2="ldap://${LOCALHOST}:$PORT2/"
 URI3="ldap://${LOCALHOST}:$PORT3/"
diff --git a/tests/scripts/test021-certificate b/tests/scripts/test021-certificate
index bf3a4683f5..655d1ac0f6 100755
--- a/tests/scripts/test021-certificate
+++ b/tests/scripts/test021-certificate
@@ -25,7 +25,7 @@ mkdir -p $TESTDIR $DBDIR1
 
 echo "Running slapadd to build slapd database..."
 . $CONFFILTER $BACKEND $MONITORDB < $CONF > $CONF1
-echo $SLAPADD -f $CONF1 -l $LDIFORDERED
+#echo $SLAPADD -f $CONF1 -l $LDIFORDERED
 $SLAPADD -f $CONF1 -l $LDIFORDERED
 RC=$?
 if test $RC != 0 ; then
diff --git a/tests/scripts/test030-relay b/tests/scripts/test030-relay
index 4aef13abfa..56a41b7e51 100755
--- a/tests/scripts/test030-relay
+++ b/tests/scripts/test030-relay
@@ -156,16 +156,16 @@ changetype: add
 objectclass: referral
 objectclass: extensibleObject
 ou: Referrals
-ref: ${URI1}ou=Referrals,$BASEDN
-description: Just added as ${URI1}ou=Referrals,$BASEDN
+ref: ldap://localhost.localdomain/ou=Referrals,$BASEDN
+description: Just added as ldap://localhost.localdomain/ou=Referrals,$BASEDN
 
 dn: ou=Referrals,$BASEDN
 changetype: modify
 replace: ref
-ref: ${URI2}ou=Referrals,$BASEDN
+ref: ldap://ldap.example.com/ou=Referrals,$BASEDN
 -
 add: description
-description: ...and modified as ${URI2}ou=Referrals,$BASEDN
+description: ...and modified as ldap://ldap.example.com/ou=Referrals,$BASEDN
 -
 EOMODS
 
@@ -187,7 +187,7 @@ fi
 
 FILTER="(objectClass=referral)"
 echo "searching filter=\"$FILTER\""
-echo "	attrs=\"'*' ref\"..."
+echo "	attrs=\"'*' ref\""
 
 BASEDN="dc=example,dc=com"
 echo "	base=\"$BASEDN\"..."
@@ -225,8 +225,8 @@ fi
 BASEDN="o=Example,c=US"
 FILTER="(seeAlso=cn=all staff,ou=Groups,$BASEDN)"
 echo "searching filter=\"$FILTER\""
-echo "	attrs=\"seeAlso\"..."
-echo "	base=\"$BASEDN\""
+echo "	attrs=\"seeAlso\""
+echo "	base=\"$BASEDN\"..."
 $LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" "$FILTER" seeAlso \
 	>> $SEARCHOUT 2>&1
 RC=$?
-- 
GitLab