storyboard/doc/source/contributing.rst
Doug Hellmann 2fe2f57b6b set up tests to run with sqlite
For most of the tests for storyboard sqlite is around 10 times faster
than MySQL (more for non-SSD systems). An sqlite database does not
support some operations, like modifying constraints or dropping
columns, so we cannot avoid testing with MySQL. We can however use
sqlite for local development to reduce the pain involved with running
tests as part of the development process.

This patch adds a tox environment for running the tests against
sqlite3. The new tox environment is intended to be used by developers
as well as the new check and gate job defined in .zuul.yaml.

The new job ensures that changes to alembic migration scripts continue
to work with sqlite.

This patch also modifies the existing alter scripts to skip steps not
supported under sqlite. Those steps aren't strictly needed, and they
are still tested when the CI system runs the tests with MySQL.

Change-Id: Icb979cb03e10c56519a90ea3976a4da2d9bddb05
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-02-05 17:48:53 -05:00

1.3 KiB

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:

$ tox -e py27

or for Python 3:

$ tox -e py35

For faster versions of the integration tests using only Python 3, run:

$ tox -e sqlite

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:

$ OS_TEST_TIMEOUT=120 tox -e py27