Since we're now doing a random password, we have to be able to override

it when we run the regression tests.
This commit is contained in:
Andrew McMillan 2006-11-23 20:25:04 +13:00
parent 58ac97191a
commit f6578fcda3
3 changed files with 14 additions and 8 deletions

View File

@ -4,6 +4,7 @@
#
DBNAME="${1:-rscds}"
ADMINPW="${2}"
DBADIR="`dirname \"$0\"`"
@ -27,13 +28,17 @@ psql -q -f "${DBADIR}/caldav_functions.sql" "${DBNAME}"
psql -q -f "${DBADIR}/base-data.sql" "${DBNAME}"
#
# Generate a random administrative password. If pwgen is available we'll use that,
# otherwise try and hack something up using a few standard utilities
PWGEN="`which pwgen`"
if [ "$PWGEN" = "" ] ; then
ADMINPW="`dd if=/dev/urandom bs=512 count=1 2>/dev/null | tr -c -d "[:alnum:]" | cut -c2-9`"
else
ADMINPW="`pwgen -Bcny | tr \"\\\'\" '^='`"
# We can override the admin password generation for regression testing predictability
if [ "${ADMINPW}" = "" ] ; then
#
# Generate a random administrative password. If pwgen is available we'll use that,
# otherwise try and hack something up using a few standard utilities
PWGEN="`which pwgen`"
if [ "$PWGEN" = "" ] ; then
ADMINPW="`dd if=/dev/urandom bs=512 count=1 2>/dev/null | tr -c -d "[:alnum:]" | cut -c2-9`"
else
ADMINPW="`pwgen -Bcny | tr \"\\\'\" '^='`"
fi
fi
psql -q -c "UPDATE usr SET password = '**${ADMINPW}' WHERE user_no = 1;" "${DBNAME}"

View File

@ -39,7 +39,7 @@ if ! dropdb ${DBNAME}; then
fi
TEST="Create-Database"
../dba/create-database.sh ${DBNAME} >"${RESULTS}/${TEST}" 2>&1
../dba/create-database.sh ${DBNAME} 'nimda' >"${RESULTS}/${TEST}" 2>&1
check_result "${TEST}"
TEST="Load-Sample-Data"

View File

@ -24,3 +24,4 @@ CREATE DATABASE
10
(1 row)
The password for the 'admin' user has been set to 'nimda'