Allow passing URI with database to tests (#942)
This commit is contained in:
+4
-2
@@ -17,8 +17,7 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
BASEPATH=$( cd $(dirname $0) ; pwd -P )
|
BASEPATH=$( cd $(dirname $0) ; pwd -P )
|
||||||
#Remove database path from the connection uri--prevents setting up the new database name with PGDATABASE
|
URI="$1"
|
||||||
URI=$(echo $1 | cut -d'/' -f1-3)
|
|
||||||
#Extract host and port--we need this to form the new connection string
|
#Extract host and port--we need this to form the new connection string
|
||||||
HOST_PORT=$(echo $URI | cut -d'/' -f3 | cut -d'@' -f2 )
|
HOST_PORT=$(echo $URI | cut -d'/' -f3 | cut -d'@' -f2 )
|
||||||
DB=$2
|
DB=$2
|
||||||
@@ -49,6 +48,9 @@ CREATE DATABASE $DB OWNER $TEST_USER_NAME;
|
|||||||
ALTER SCHEMA public OWNER TO $TEST_USER_NAME;
|
ALTER SCHEMA public OWNER TO $TEST_USER_NAME;
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
#Remove database path from the connection uri--prevents setting up the new database name with PGDATABASE
|
||||||
|
URI=$(echo $URI | cut -d'/' -f1-3)
|
||||||
|
|
||||||
PGDATABASE=$DB PGOPTIONS='-c client_min_messages=WARNING' psql "$URI" --set=db=$DB -Xq <<EOF
|
PGDATABASE=$DB PGOPTIONS='-c client_min_messages=WARNING' psql "$URI" --set=db=$DB -Xq <<EOF
|
||||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||||
ALTER DATABASE ${DB} SET request.jwt.claim.id = '-1';
|
ALTER DATABASE ${DB} SET request.jwt.claim.id = '-1';
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
BASEPATH=$( cd $(dirname $0) ; pwd -P )
|
BASEPATH=$( cd $(dirname $0) ; pwd -P )
|
||||||
#Remove database path from the connection uri
|
URI="$1"
|
||||||
URI=$(echo $1 | cut -d'/' -f1-3)
|
|
||||||
DB=$2
|
DB=$2
|
||||||
|
|
||||||
PGOPTIONS='-c client_min_messages=WARNING' psql "$URI" -Xq >/dev/null -c 'select rolcreatedb from pg_authid where rolname = current_user;' 2>/dev/null
|
PGOPTIONS='-c client_min_messages=WARNING' psql "$URI" -Xq >/dev/null -c 'select rolcreatedb from pg_authid where rolname = current_user;' 2>/dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user