#!/bin/bash -x

# Start PostgreSQL process for tests
PGSQL_DATA=`mktemp -d /tmp/gnocchi-psql-XXXXX`
PGSQL_PATH=`pg_config --bindir`
PGSQL_PORT=9823
${PGSQL_PATH}/initdb ${PGSQL_DATA}
LANGUAGE=C ${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-k ${PGSQL_DATA} -p ${PGSQL_PORT}" start > /dev/null
export GNOCCHI_TEST_PGSQL_URL="postgresql:///?host=${PGSQL_DATA}&port=${PGSQL_PORT}&dbname=template1"

mkdir $PGSQL_DATA/tooz
export GNOCCHI_COORDINATION_URL="file:///$PGSQL_DATA/tooz"

$*

ret=$?
${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-p $PGSQL_PORT" stop
rm -rf ${PGSQL_DATA}
exit $ret

#!/bin/bash -x

# Start PostgreSQL process for tests
PGSQL_DATA=`mktemp -d /tmp/gnocchi-psql-XXXXX`
PGSQL_PATH=`pg_config --bindir`
PGSQL_PORT=9823
${PGSQL_PATH}/initdb ${PGSQL_DATA}
LANGUAGE=C ${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-k ${PGSQL_DATA} -p ${PGSQL_PORT}" start > /dev/null
export GNOCCHI_TEST_PGSQL_URL="postgresql:///template1?host=${PGSQL_DATA}&port=${PGSQL_PORT}"

mkdir $PGSQL_DATA/tooz
export GNOCCHI_COORDINATION_URL="file:///$PGSQL_DATA/tooz"

$*

ret=$?
${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-p $PGSQL_PORT" stop
rm -rf ${PGSQL_DATA}
exit $ret

Put dbname in the path section of postgresql URL
Put dbname in the path section of postgresql URL

This makes it easier to manipulate the name of the database when
using sqlalchemy-utils' url parser.

Change-Id: Ic8ed89215a0d0ae6d7ff81e39a7b46a1e0acdfab
