Update tox.ini to skip dtabase creation steps

after https://github.com/openstack-infra/project-config/
commit/7334ceb347329ccbc04dc6bff536e88e12783a86 we do not need to
create db, user, role.

Also add usage of CUSTOM_OSTF_CONFIG env variable, to pass
correctly dbpath tp fuel_plugin.config.py

Closes-Bug: #1554086

Change-Id: Ic2881e1cb17693ab616044029325a601d2b04e2c
This commit is contained in:
Tatyana Leontovich 2016-03-07 13:37:24 +02:00
parent 155450a648
commit 003272dc29
3 changed files with 8 additions and 21 deletions

View File

@ -5,18 +5,4 @@ echo "*:*:*:${OSTF_DB_ROOT}:${OSTF_DB_ROOTPW}" > ${OSTF_DB_ROOTPGPASS}
chmod 600 ${OSTF_DB_ROOTPGPASS}
export PGPASSFILE=${OSTF_DB_ROOTPGPASS}
echo "Trying to find out if role ${OSTF_DB_USER} exists"
root_roles=$(psql -h 127.0.0.1 -U ${OSTF_DB_ROOT} -t -c "SELECT 'HERE' from pg_roles where rolname='${OSTF_DB_USER}'")
if [[ ${root_roles} == *HERE ]];then
echo "Role ${OSTF_DB_USER} exists. Setting password ${OSTF_DB_PW}"
psql -h 127.0.0.1 -U ${OSTF_DB_ROOT} -c "ALTER ROLE ${OSTF_DB_USER} WITH SUPERUSER LOGIN PASSWORD '${OSTF_DB_PW}'"
else
echo "Creating role ${OSTF_DB_USER} with password ${OSTF_DB_PASSWD}"
psql -h 127.0.0.1 -U ${OSTF_DB_ROOT} -c "CREATE ROLE ${OSTF_DB_USER} WITH SUPERUSER LOGIN PASSWORD '${OSTF_DB_PW}'"
fi
echo "Dropping database ${OSTF_DB} if exists"
psql -h 127.0.0.1 -U ${OSTF_DB_ROOT} -c "DROP DATABASE IF EXISTS ${OSTF_DB}"
echo "Creating database ${OSTF_DB}"
psql -h 127.0.0.1 -U ${OSTF_DB_ROOT} -c "CREATE DATABASE ${OSTF_DB} OWNER ${OSTF_DB_USER}"
cat $PGPASSFIL

View File

@ -1,11 +1,12 @@
#!/bin/sh
cat > ${OSTF_CI_CONF} <<EOL
cat > ${CUSTOM_OSTF_CONFIG} <<EOL
[adapter]
server_host = 127.0.0.1
server_port = 8777
nailgun_host = 127.0.0.1
nailgun_port = 8000
dbpath = "postgresql+psycopg2://${OSTF_DB_USER}:${OSTF_DB_PW}@localhost/${OSTF_DB}"
log_file = ${OSTF_LOGS}"
after_init_hook = False
auth_enable = False

10
tox.ini
View File

@ -12,15 +12,15 @@ skipsdist = True
usedevelop = True
whitelist_externals = bash
setenv = VIRTUAL_ENV={envdir}
OSTF_CI_CONF={toxinidir}/etc/tools/ostf_ci.conf
CUSTOM_OSTF_CONFIG={toxinidir}/etc/tools/ostf_ci.conf
OSTF_LOGS={toxinidir}/ostf
OSTF_DB=ostf
OSTF_DB_USER=ostf
OSTF_DB_PW=ostf
OSTF_DB=openstack_citest
OSTF_DB_USER=openstack_citest
OSTF_DB_PW=openstack_citest
OSTF_DB_ROOT=postgres
OSTF_DB_ROOTPW=insecure_slave
OSTF_DB_ROOTPGPASS={toxinidir}/pgpass
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY CUSTOM_OSTF_CONFIG
deps = -r{toxinidir}/test-requirements.txt
commands =
/bin/bash "{toxinidir}/etc/tools/prepare_settings.sh"