ceilometer/setup-test-env-postgresql.sh
Joe H. Rahme 52598e1272 Run unit tests against PostgreSQL
* Creates a new tox env py-pgsql
* Adds a new script setupt-test-env-postgresql.sh to set up postgresql
* Renames the MySQLDbManager into SQLManage, used by both mysql and
  postgresql tests
* Creates a new scenario for posgresql in the
  MixinTestsWithBackendScenarios

Related to blueprint sql-unit-tests-on-real-backend
Co-Authored-By: Ala Rezmerita <ala.rezmerita@cloudwatt.com>

Change-Id: I60af82d5d8b5750884ba0d1ca726645f8b31448b
2014-10-03 11:02:03 +02:00

28 lines
755 B
Bash

#!/bin/bash
set -e
source functions.sh
if [ "$1" = "--coverage" ]; then
COVERAGE_ARG="$1"
shift
fi
#export PATH=${PATH:+$PATH:}/sbin:/usr/sbin
check_for_cmd pg_config
# Start PostgreSQL process for tests
PGSQL_DATA=`mktemp -d /tmp/CEILO-PGSQL-XXXXX`
trap "clean_exit ${PGSQL_DATA}" EXIT
PGSQL_PATH=`pg_config --bindir`
${PGSQL_PATH}/initdb ${PGSQL_DATA}
mkfifo ${PGSQL_DATA}/out
${PGSQL_PATH}/postgres -N 100 -F -k ${PGSQL_DATA} -D ${PGSQL_DATA} -p 9823 &> ${PGSQL_DATA}/out &
# Wait for PostgreSQL to start listening to connections
wait_for_line "database system is ready to accept connections" ${PGSQL_DATA}/out
export CEILOMETER_TEST_PGSQL_URL="postgresql:///?host=${PGSQL_DATA}&port=9823&dbname=template1"
# Yield execution to venv command
$*