diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst index 17bd60db..84b843c2 100644 --- a/doc/source/contributing.rst +++ b/doc/source/contributing.rst @@ -6,32 +6,19 @@ Running the Tests ----------------- -The test suite includes functional tests that use a MySQL database, so -you must configure a database user. - -For MySQL you can use the following commands:: - - mysql -u root - mysql> CREATE USER 'openstack_citest'@'localhost' IDENTIFIED BY - 'openstack_citest'; - mysql> GRANT ALL PRIVILEGES ON * . * TO 'openstack_citest'@'localhost'; - mysql> FLUSH PRIVILEGES; - -Note that the script tools/test-setup.sh can be used for the step -above. - Storyboard uses tox_ to manage its unit and functional tests. After -installing tox and downloading the storyboard source, run the tests -with:: +installing tox and downloading the storyboard source the next step is +to install system dependencies. Run:: - $ tox -e py27 + $ tox -e bindep -or for Python 3:: +Then take the listed packages and install them with your system package +manager. For example:: - $ tox -e py35 + $ sudo apt-get install package list here -For faster versions of the integration tests using only Python 3, -run:: +To run the tests quickly on your local development machine you can run +the tests with the sqlite backend:: $ tox -e sqlite @@ -39,11 +26,31 @@ And to run the style-checker and static analysis tool:: $ tox -e pep8 -On slower systems, the database migrations may take longer than the -default timeout of 60 seconds. To override the timeout, set the -``OS_TEST_TIMEOUT`` environment variable. For example, to set the -timeout to 2 minutes, run:: +If you would like to run the test suite with proper database backends or +with python2 instead of python3 there is one more step to follow. Note +that the testsuite takes quite a bit longer to run when using the MySQL +and PostgreSQL database backends. - $ OS_TEST_TIMEOUT=120 tox -e py27 +First ensure MySQL and PostgreSQL are running (you may need to start +these services). Then run the test-setup.sh helper script:: + + $ tools/test-setup.sh + +This script needs to be run with a user that has sudo access. It will +configure the databases as needed to run the unittests. You can then +runt the unittests with:: + + $ tox -e py27 + +or for Python 3:: + + $ tox -e py35 + +On slower systems, the database migrations may take longer than the +default timeout of 120 seconds. To override the timeout, set the +``OS_TEST_TIMEOUT`` environment variable. For example, to set the +timeout to 3 minutes, run:: + + $ OS_TEST_TIMEOUT=180 tox -e py27 .. _tox: https://tox.readthedocs.io/en/latest/