CVS User Account cvsuser
Thu Nov 10 20:56:02 PST 2005
Log Message:
-----------
Change test bed to allow configuring, for each DB instance, the
PostgreSQL binaries to run as well as the port number.

Modified Files:
--------------
    slony1-engine/tests:
        run_test.sh (r1.2 -> r1.3)
        settings.ik (r1.1 -> r1.2)
    slony1-engine/tests/test1:
        init_add_tables.ik (r1.1 -> r1.2)
    slony1-engine/tests/test2:
        init_dropnode.sh (r1.1 -> r1.2)

-------------- next part --------------
Index: settings.ik
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tests/settings.ik,v
retrieving revision 1.1
retrieving revision 1.2
diff -Ltests/settings.ik -Ltests/settings.ik -u -w -r1.1 -r1.2
--- tests/settings.ik
+++ tests/settings.ik
@@ -5,52 +5,77 @@
 DB1=${DB1:-"slonyregress1"}
 HOST1=${HOST1:-"localhost"}
 USER1=${USER1:-${PGUSER:-"postgres"}}
+PORT1=${PORT1:-${PGPORT:-"5432"}}
+PGBINDIR1=${PGBINDIR1:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB2=${DB2:-"slonyregress2"}
 HOST2=${HOST2:-"localhost"}
 USER2=${USER2:-${PGUSER:-"postgres"}} 
+PORT2=${PORT2:-${PGPORT:-"5432"}}
+PGBINDIR2=${PGBINDIR2:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB3=${DB3:-"slonyregress3"}
-HOST3=${HOST2:-"localhost"}
-USER3=${USER2:-${PGUSER:-"postgres"}}
+HOST3=${HOST3:-"localhost"}
+USER3=${USER3:-${PGUSER:-"postgres"}}
+PORT3=${PORT3:-${PGPORT:-"5432"}}
+PGBINDIR3=${PGBINDIR3:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB4=${DB4:-"slonyregress4"}
 HOST4=${HOST4:-"localhost"}
 USER4=${USER4:-${PGUSER:-"postgres"}}
+PORT4=${PORT4:-${PGPORT:-"5432"}}
+PGBINDIR4=${PGBINDIR4:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB5=${DB5:-"slonyregress5"}
 HOST5=${HOST5:-"localhost"}
 USER5=${USER5:-${PGUSER:-"postgres"}}
+PORT5=${PORT5:-${PGPORT:-"5432"}}
+PGBINDIR5=${PGBINDIR5:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB6=${DB6:-"slonyregress6"}
 HOST6=${HOST6:-"localhost"}
 USER6=${USER6:-${PGUSER:-"postgres"}}
+PORT6=${PORT6:-${PGPORT:-"5432"}}
+PGBINDIR6=${PGBINDIR6:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB7=${DB7:-"slonyregress7"}
 HOST7=${HOST7:-"localhost"}
 USER7=${USER7:-${PGUSER:-"postgres"}}
+PORT7=${PORT7:-${PGPORT:-"5432"}}
+PGBINDIR7=${PGBINDIR7:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB8=${DB8:-"slonyregress8"}
 HOST8=${HOST8:-"localhost"}
 USER8=${USER8:-${PGUSER:-"postgres"}}
+PORT8=${PORT8:-${PGPORT:-"5432"}}
+PGBINDIR8=${PGBINDIR8:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB9=${DB9:-"slonyregress9"}
 HOST9=${HOST9:-"localhost"}
 USER9=${USER9:-${PGUSER:-"postgres"}}
+PORT9=${PORT9:-${PGPORT:-"5432"}}
+PGBINDIR9=${PGBINDIR9:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB10=${DB10:-"slonyregress10"}
 HOST10=${HOST10:-"localhost"}
 USER10=${USER10:-${PGUSER:-"postgres"}}
+PORT10=${PORT10:-${PGPORT:-"5432"}}
+PGBINDIR10=${PGBINDIR10:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB11=${DB11:-"slonyregress11"}
 HOST11=${HOST11:-"localhost"}
 USER11=${USER11:-${PGUSER:-"postgres"}}
+PORT11=${PORT11:-${PGPORT:-"5432"}}
+PGBINDIR11=${PGBINDIR11:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB12=${DB12:-"slonyregress12"}
 HOST12=${HOST12:-"localhost"}
 USER12=${USER12:-${PGUSER:-"postgres"}}
+PORT12=${PORT12:-${PGPORT:-"5432"}}
+PGBINDIR12=${PGBINDIR12:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
 
 DB13=${DB13:-"slonyregress13"}
 HOST13=${HOST13:-"localhost"}
 USER13=${USER13:-${PGUSER:-"postgres"}}
-
+PORT13=${PORT13:-${PGPORT:-"5432"}}
+PGBINDIR13=${PGBINDIR13:-${PGBINDIR:-"/usr/local/pgsql/bin"}}
Index: run_test.sh
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tests/run_test.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -Ltests/run_test.sh -Ltests/run_test.sh -u -w -r1.2 -r1.3
--- tests/run_test.sh
+++ tests/run_test.sh
@@ -228,18 +228,20 @@
         eval db=\$DB${originnode}
         eval host=\$HOST${originnode}
         eval user=\$USER${originnode}
+	eval pgbindir=\$PGBINDIR${originnode}
+	eval port=\$PORT${originnode}
 
 	if [ -n "${db}" -a "${host}" -a "${user}" ]; then
-	  status "creating origin DB: $user -h $host -U $user $db"
-  	  $pgbindir/createdb -O $user -h $host -U $user $db 1> ${mktmp}/createdb.${originnode} 2> ${mktmp}/createdb.${originnode}
+	  status "creating origin DB: $user -h $host -U $user -p $port $db"
+  	  $pgbindir/createdb -O $user -h $host -U $user -p $port $db 1> ${mktmp}/createdb.${originnode} 2> ${mktmp}/createdb.${originnode}
 	  if [ $? -ne 0 ]; then	   
-	    err 3 "An error occured trying to $pgbindir/createdb -O $user -h $host -U $user $db, ${mktmp}/createdb.${originnode} for details"
+	    err 3 "An error occured trying to $pgbindir/createdb -O $user -h $host -U $user -p $port $db, ${mktmp}/createdb.${originnode} for details"
 	  fi
 	else
-	  err 3 "No db '${db}' or host '${host}' or user '${user}' specified"
+	  err 3 "No db '${db}' or host '${host}' or user '${user}' or port '${port}' specified"
 	fi
 	status "loading origin DB with $testname/init_schema.sql"
-	$pgbindir/psql -h $host $db $user < $testname/init_schema.sql 1> ${mktmp}/init_schema.sql.${originnode} 2>${mktmp}/init_schema.sql.${originnode}
+	$pgbindir/psql -h $host -p $port $db $user < $testname/init_schema.sql 1> ${mktmp}/init_schema.sql.${originnode} 2>${mktmp}/init_schema.sql.${originnode}
 	status "done"
 }
 
@@ -249,6 +251,8 @@
         eval odb=\$DB${originnode}
         eval ohost=\$HOST${originnode}
         eval ouser=\$USER${originnode}
+	eval opgbindir=\$PGBINDIR${originnode}
+	eval oport=\$PORT${originnode}
 
         if [ -n "${odb}" -a "${ohost}" -a "${ouser}" ]; then
           alias=1
@@ -256,13 +260,15 @@
             eval db=\$DB${alias}
             eval host=\$HOST${alias}
             eval user=\$USER${alias}
+	    eval pgbindir=\$PGBINDIR${alias}
+	    eval port=\$PORT${alias}
 
-            if [ -n "${db}" -a "${host}" -a "${user}" ]; then
+            if [ -n "${db}" -a "${host}" -a "${user}" -a "${port}" ]; then
               if [ ${alias} -ne ${originnode} ]; then
-		status "creating subscriber ${alias} DB: $user -h $host -U $user $db"
-	        $pgbindir/createdb -O $user -h $host -U $user $db 1> ${mktmp}/createdb.${alias} 2> ${mktmp}/createdb.${alias}
+		status "creating subscriber ${alias} DB: $user -h $host -U $user -p $port $db"
+	        $pgbindir/createdb -O $user -h $host -U $user -p $port $db 1> ${mktmp}/createdb.${alias} 2> ${mktmp}/createdb.${alias}
 		status "loading subscriber ${alias} DB from $odb"
-	        $pgbindir/pg_dump -s  -h $ohost -U $ouser $odb | $pgbindir/psql -h $host $db $user 1> ${mktmp}/init_schema.sql.${alias} 2> ${mktmp}/init_schema.sql.${alias}
+	        $opgbindir/pg_dump -s  -h $ohost -U $ouser -p $oport $odb | $pgbindir/psql -h $host -p $port $db $user 1> ${mktmp}/init_schema.sql.${alias} 2> ${mktmp}/init_schema.sql.${alias}
 		status "done"
               fi
               if [ ${alias} -ge ${NUMNODES} ]; then
@@ -288,11 +294,13 @@
 	  eval db=\$DB${alias}
 	  eval host=\$HOST${alias}
 	  eval user=\$USER${alias}
+	  eval pgbindir=\$PGBINDIR${alias}
+	  eval port=\$PORT${alias}
 
 	  status "${db}"
 
-	  if [ -n "${db}" -a "${host}" -a "${user}" ]; then
-	    $pgbindir/dropdb -U $user -h $host $db 1> ${mktmp}/dropdb.${alias} 2> ${mktmp}/dropdb.${alias}
+	  if [ -n "${db}" -a "${host}" -a "${user}" -a "${port}" ]; then
+	    $pgbindir/dropdb -U $user -h $host -p $port $db 1> ${mktmp}/dropdb.${alias} 2> ${mktmp}/dropdb.${alias}
 	    if [ ${alias} -ge ${NUMNODES} ]; then
               break;
             else
@@ -349,16 +357,18 @@
         eval odb=\$DB${originnode}
         eval ohost=\$HOST${originnode}
         eval ouser=\$USER${originnode}
+	eval opgbindir=\$PGBINDIR${originnode}
+	eval oport=\$PORT${originnode}
 	if [ -n "${odb}" -a "${ohost}" -a "${ouser}" ]; then
 		
 	  if [ -f $testname/init_data.sql ]; then
-	    $pgbindir/psql -h $ohost $odb $ouser < $testname/init_data.sql 1> $mktmp/init_data.sql.log 2> $mktmp/init_data.sql.log
+	    $opgbindir/psql -h $ohost -p $oport $odb $ouser < $testname/init_data.sql 1> $mktmp/init_data.sql.log 2> $mktmp/init_data.sql.log
 	    if [ $? -ne 0 ]; then
               warn 3 "$testname/init_data.sql generated an error see $mktmp/init_data.sql.log for details"
 	    fi
 	  fi
         else
-          err 3 "No origin found in ${odb} ${ohost} ${ouser}"
+          err 3 "No origin found in ${odb} ${ohost} ${ouser} ${oport}"
 	fi
 }
 
@@ -380,19 +390,21 @@
   eval odb=\$DB${originnode}
   eval ohost=\$HOST${originnode}
   eval ouser=\$USER${originnode}
+  eval opgbindir=\$PGBINDIR${originnode}
+  eval oport=\$PORT${originnode}
   eval cluster=\$CLUSTER1
-  conninfo="-h ${ohost} ${odb} ${ouser}"
+  conninfo="-h ${ohost} -p ${oport} ${odb} ${ouser}"
   status "launching polling script"
   case `uname` in
     MINGW32*)
-      ./poll_cluster.sh "$mktmp" "${cluster}" "${conninfo}" "${pgbindir}" /dev/tty &
+      ./poll_cluster.sh "$mktmp" "${cluster}" "${conninfo}" "${opgbindir}" /dev/tty &
       poll_pid=$!
       ;;
     *)
       if [ "x$SHLVL" != "x" ]; then
-        ./poll_cluster.sh "$mktmp" "${cluster}" "${conninfo}" "${pgbindir}" `tty` &
+        ./poll_cluster.sh "$mktmp" "${cluster}" "${conninfo}" "${opgbindir}" `tty` &
       else
-        ./poll_cluster.sh "$mktmp" "${cluster}" "${conninfo}" "${pgbindir}" /dev/null &
+        ./poll_cluster.sh "$mktmp" "${cluster}" "${conninfo}" "${opgbindir}" /dev/null &
       fi
       tmppid=$!
       tmpppid=$$
@@ -413,11 +425,13 @@
   eval odb=\$DB${originnode}
   eval ohost=\$HOST${originnode}
   eval ouser=\$USER${originnode}
+  eval opgbindir=\$PGBINDIR${originnode}
+  eval oport=\$PORT${originnode}
   eval cluster=\$CLUSTER1
 
-  conninfo="dbname=${odb} host=${ohost} user=${ouser}"
-  status "launching originnode : $pgbindir/slon -s500 -g10 $cluster \"$conninfo\""
-  $pgbindir/slon -s500 -g10 $cluster "$conninfo" 1> $mktmp/slon_log.${originnode} 2> $mktmp/slon_log.${originnode} &
+  conninfo="dbname=${odb} host=${ohost} user=${ouser} port=${oport}"
+  status "launching originnode : $opgbindir/slon -s500 -g10 $cluster \"$conninfo\""
+  $opgbindir/slon -s500 -g10 $cluster "$conninfo" 1> $mktmp/slon_log.${originnode} 2> $mktmp/slon_log.${originnode} &
   tmppid=$!
   tmpppid=$$
   sleep 1
@@ -436,16 +450,18 @@
       eval db=\$DB${alias}
       eval host=\$HOST${alias}
       eval user=\$USER${alias}
+      eval pgbindir=\$PGBINDIR${alias}
+      eval port=\$PORT${alias}
       eval cluster=\$CLUSTER1
 
-      if [ -n "${db}" -a "${host}" -a "${user}" ]; then
+      if [ -n "${db}" -a "${host}" -a "${user}" -a "${port}" ]; then
         unset conninfo
 
         unset tmppid
         unset tmpppid
         eval slon${alias}_pid=
 
-        conninfo="dbname=${db} host=${host} user=${user}"
+        conninfo="dbname=${db} host=${host} user=${user} port=${port}"
 
         status "launching: $pgbindir/slon -s500 -g10 $cluster \"$conninfo\""
 
@@ -477,13 +493,15 @@
   eval odb=\$DB${originnode}
   eval ohost=\$HOST${originnode}
   eval ouser=\$USER${originnode}
+  eval opgbindir=\$PGBINDIR${originnode}
+  eval oport=\$PORT${originnode}
 
   alias=1
   while : ; do
     eval cluster=\$CLUSTER${alias}
     if [ -n "${cluster}" ]; then
       SQL="SELECT * FROM \"_${cluster}\".sl_status"
-      ${pgbindir}/psql -c "${SQL}" -h ${ohost} ${odb} ${ouser}
+      ${opgbindir}/psql -c "${SQL}" -h ${ohost} -p ${oport} ${odb} ${ouser}
       if [ ${alias} -ge ${NUMCLUSTERS} ]; then
         break;
       else
@@ -514,13 +532,15 @@
   eval odb=\$DB${originnode}
   eval ohost=\$HOST${originnode}
   eval ouser=\$USER${originnode}
+  eval opgbindir=\$PGBINDIR${originnode}
+  eval oport=\$PORT${originnode}
 
   if [ -f ${mktmp}/db_${originnode}.dmp ]; then
     err 3 "${mktmp}/db_${originnode}.dmp exists but should not"
   fi
   status "getting data from origin DB for diffing"
   cat ${testname}/schema.diff | while read SQL; do
-    ${pgbindir}/psql -c "${SQL}" -h ${ohost} ${odb} ${ouser} >> ${mktmp}/db_${originnode}.dmp
+    ${opgbindir}/psql -c "${SQL}" -h ${ohost} -p ${oport} ${odb} ${ouser} >> ${mktmp}/db_${originnode}.dmp
   done
   status "done"
   alias=1
@@ -528,15 +548,17 @@
     eval db=\$DB${alias}
     eval host=\$HOST${alias}
     eval user=\$USER${alias}
+    eval port=\$PORT${alias}
+    eval pgbindir=\$PGBINDIR${alias}
 
-    if [ -n "${db}" -a "${host}" -a "${user}" ]; then
+    if [ -n "${db}" -a "${host}" -a "${user}" -a "${port}" ]; then
       if [ ${alias} -ne ${originnode} ]; then
         if [ -f ${mktmp}/db_${alias}.dmp ]; then
           err 3 "${mktmp}/db_${alias}.dmp exists but should not"
         fi
 	status "getting data from node ${alias} for diffing against origin"
         cat ${testname}/schema.diff | while read SQL; do
-          ${pgbindir}/psql -h ${host} -c "${SQL}" ${db} ${user} >> ${mktmp}/db_${alias}.dmp
+          ${pgbindir}/psql -h ${host} -c "${SQL}" -p ${port} ${db} ${user} >> ${mktmp}/db_${alias}.dmp
         done
 	status "comparing"
 	diff ${mktmp}/db_${originnode}.dmp ${mktmp}/db_${alias}.dmp > ${mktmp}/db_diff.${alias}
Index: init_add_tables.ik
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tests/test1/init_add_tables.ik,v
retrieving revision 1.1
retrieving revision 1.2
diff -Ltests/test1/init_add_tables.ik -Ltests/test1/init_add_tables.ik -u -w -r1.1 -r1.2
--- tests/test1/init_add_tables.ik
+++ tests/test1/init_add_tables.ik
@@ -2,4 +2,3 @@
 set add table(id=2, set id=1, origin=1, fully qualified name = 'public.table2', key='table2_id_key');
 table add key (node id = 1, fully qualified name = 'public.table3');
 set add table(id=3, set id=1, origin=1, fully qualified name = 'public.table3', key = SERIAL);
-
Index: init_dropnode.sh
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tests/test2/init_dropnode.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -Ltests/test2/init_dropnode.sh -Ltests/test2/init_dropnode.sh -u -w -r1.1 -r1.2
--- tests/test2/init_dropnode.sh
+++ tests/test2/init_dropnode.sh
@@ -1,7 +1,7 @@
 echo <<EOF
 CLUSTER NAME = $CLUSTER1
-NODE 1 ADMIN CONNINFO = 'dbname=$DB1 host=$HOST1 user=$USER1 ';
-NODE 3 ADMIN CONNINFO = 'dbname=$DB3 host=$HOST3 user=$USER3 ';
+NODE 1 ADMIN CONNINFO = 'dbname=$DB1 host=$HOST1 user=$USER1 port=$PORT1 ';
+NODE 3 ADMIN CONNINFO = 'dbname=$DB3 host=$HOST3 user=$USER3 port=$PORT3 ';
 drop node (id = 2);
 EOF
 


More information about the Slony1-commit mailing list