Revert fix pifpaf run postgresql failing

This reverts https://review.gerrithub.io/#/c/393980/ which was
a temporary workaround to unblock the Deckhand gate. pifpaf should
be used to run unit tests as having to install Docker just to kick
off unit tests is excessive.

However, the unit-tests.sh script is maintained in tools/ directory
as a fallback.

Change-Id: I24a10d4b3ea00006004f27d0086719fb0bf86dd9
This commit is contained in:
Felipe Monteiro 2018-01-12 03:28:49 +00:00
parent 69db7f81fa
commit 2f0d5796e3
5 changed files with 12 additions and 5 deletions

View File

@ -105,8 +105,10 @@ class DeckhandWithDBTestCase(DeckhandTestCase):
def setUp(self):
super(DeckhandWithDBTestCase, self).setUp()
if 'PIFPAF_URL' not in os.environ:
raise RuntimeError('Unit tests must be run using `pifpaf run '
'postgresql`.')
self.override_config(
'connection', os.environ.get('DATABASE_URL', 'sqlite://'),
group='database')
'connection', os.environ['PIFPAF_URL'], group='database')
db_api.setup_db()
self.addCleanup(db_api.drop_db)

View File

@ -16,6 +16,7 @@ testtools>=1.4.0 # MIT
bandit>=1.1.0 # Apache-2.0
gabbi==1.35.1
pytest-html==1.16.0
pifpaf==2.0.0
# NOTE(fmontei): The requirement below is only included because readthedocs
# depends on it to work, since it runs pip install -rtest-requirements.txt.

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# Script intended for running Deckhand functional tests via gabbi. Requires
# Docker CE (at least) to run.
# Meant for capturing output of Deckhand image. This requires that logging
# in the image be set up to pipe everything out to stdout/stderr.
STDOUT=$(mktemp)

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash
# Script for setting up temporary PostgreSQL database for testing unit tests
# against.
# against. Requires Docker CE (at least) to be executed. Fallback in case
# `pifpaf` fails.
function cleanup {
sudo docker stop $POSTGRES_ID

View File

@ -21,12 +21,12 @@ commands =
[testenv:py27]
commands =
{[testenv]commands}
{toxinidir}/tools/unit-tests.sh '{posargs}'
pifpaf run postgresql -- '{toxinidir}'/tools/pretty_tox.sh '--concurrency=1 {posargs}'
[testenv:py35]
commands =
{[testenv]commands}
{toxinidir}/tools/unit-tests.sh '{posargs}'
pifpaf run postgresql -- '{toxinidir}'/tools/pretty_tox.sh '--concurrency=1 {posargs}'
[testenv:functional]
usedevelop = True