summaryrefslogtreecommitdiff
path: root/CONTRIBUTING.rst
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2016-04-13 23:17:57 +0200
committerJulien Danjou <julien@danjou.info>2016-05-19 16:19:53 +0200
commit044cf85ef562da1cea696fc047277297c6ee7bf4 (patch)
tree9bcd716d6c606f321695433e61440bbade6abf37 /CONTRIBUTING.rst
parent663092d675bca7c2420665b820db9306e381d73f (diff)
downloadoslo-db-044cf85ef562da1cea696fc047277297c6ee7bf4.tar.gz
Allow testing of MySQL and PostgreSQL scenario locally
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
Diffstat (limited to 'CONTRIBUTING.rst')
-rw-r--r--CONTRIBUTING.rst27
1 files changed, 27 insertions, 0 deletions
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 019004c..aa704f9 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -59,4 +59,31 @@ For MySQL you can use the following commands::
mysql> GRANT ALL PRIVILEGES ON * . * TO 'openstack_citest'@'localhost';
mysql> FLUSH PRIVILEGES;
+Alternatively, you can use `pifpaf`_ to run the unit tests directly without
+setting up the database yourself. You still need to have the database software
+installed on your system. The following tox environments can be used::
+
+ tox -e py27-mysql
+ tox -e py27-postgresql
+ tox -e py34-mysql
+ tox -e py34-postgresql
+ tox -e py27-all
+ tox -e py34-all
+
+The database will be set up for you locally and temporarily on each run.
+
+Another way is to start `pifpaf` manually and use it to run the tests as you
+wish::
+
+ $ 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 once you're done
+ $ kill $PIFPAF_PID
+
.. _wiki: https://wiki.openstack.org/wiki/Testing#Unit_Tests
+.. _pifpaf: https://github.com/jd/pifpaf