From 044cf85ef562da1cea696fc047277297c6ee7bf4 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 13 Apr 2016 23:17:57 +0200 Subject: Allow testing of MySQL and PostgreSQL scenario locally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This leverage pifpaf to start MySQL or PostgreSQL temporarily and allow to test provisioning directly without being on OpenStack CI by adding new tox targets: - py27-mysql - py27-postgresql - py34-mysql - py34-postgresql - py27-all - py34-all These targets will start MySQL or PostgreSQL before running the tests, while exporting the connection string to $PIFPAF_URL. The `all' target will start both MySQL and PostgreSQL and will run the tests against these backends, plus SQLite. Also, this patches add OS_TEST_DBAPI_ADMIN_CONNECTION to be allowed to be passed through tox. This allows to run the opportunistic tests on a more persistent pifpaf database, for example by running tox with: $ eval `pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run postgresql` $ echo $OS_TEST_DBAPI_ADMIN_CONNECTION postgresql://localhost/postgres?host=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmpMGqN8C&port=9824 $ tox -e py27 […] $ tox -e py34 […] $ kill $PIFPAF_PID Change-Id: I1ee582e6f96e98378f02be79f4aaff0f447a062a Depends-On: Id3e6b694bb186724517599cd9875ad80ceeee053 --- tox.ini | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'tox.ini') diff --git a/tox.ini b/tox.ini index a54730f..0e073f8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 1.6 +minversion = 1.8 envlist = py34,py27,pep8,pip-missing-reqs [testenv] @@ -8,7 +8,9 @@ whitelist_externals = bash setenv = VIRTUAL_ENV={envdir} deps = .[test,fixtures,mysql,postgresql] + py{27,34}-{postgresql,mysql,all}: .[pifpaf] commands = bash tools/pretty_tox.sh '{posargs}' +passenv = OS_TEST_DBAPI_ADMIN_CONNECTION [testenv:sqla_09] commands = pip install SQLAlchemy>=0.9.0,!=0.9.5,<1.0.0 @@ -19,6 +21,28 @@ commands = env TEST_EVENTLET=0 bash tools/pretty_tox.sh '{posargs}' env TEST_EVENTLET=1 bash tools/pretty_tox.sh '{posargs}' +[testenv:py27-all] +commands = pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run mysql -- pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run postgresql -- {toxinidir}/tools/run-pifpaf-tests.sh {posargs} + +[testenv:py34-all] +commands = pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run mysql -- pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run postgresql -- {toxinidir}/tools/run-pifpaf-tests.sh {posargs} + +[testenv:py27-mysql] +commands = + pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run mysql {toxinidir}/tools/run-pifpaf-tests.sh {posargs} + +[testenv:py27-postgresql] +commands = + pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run postgresql {toxinidir}/tools/run-pifpaf-tests.sh {posargs} + +[testenv:py34-mysql] +commands = + pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run mysql {toxinidir}/tools/run-pifpaf-tests.sh {posargs} + +[testenv:py34-postgresql] +commands = + pifpaf -g OS_TEST_DBAPI_ADMIN_CONNECTION run postgresql {toxinidir}/tools/run-pifpaf-tests.sh {posargs} + [testenv:mysql-python] deps = .[mysql-c,postgresql,test,fixtures] setenv = -- cgit v1.2.1