Change-Id: Ibd4c9811daa6e9e692457ce480a58c964fef7cb9 Signed-off-by: Julien Danjou <julien@danjou.info>
2.7 KiB
Running the Tests
Aodh includes an extensive set of automated unit tests which are run through tox.
Install
tox
:$ sudo pip install tox
On Ubuntu install
mongodb
andlibmysqlclient-dev
packages:$ sudo apt-get install mongodb $ sudo apt-get install libmysqlclient-dev
For Fedora20 there is no
libmysqlclient-dev
package, so you’ll need to installmariadb-devel.x86-64
(ormariadb-devel.i386
) instead:$ sudo yum install mongodb $ sudo yum install mariadb-devel.x86_64
Install the test dependencies:
$ sudo pip install -r /opt/stack/aodh/test-requirements.txt
Run the unit and code-style tests:
$ cd /opt/stack/aodh $ tox -e py27,pep8
As tox is a wrapper around testr, it also accepts the same flags as testr. See the testr documentation for details about these additional flags.
Use a double hyphen to pass options to testr. For example, to run only tests under tests/api/v2:
$ tox -e py27 -- api.v2
To debug tests (ie. break into pdb debugger), you can use ''debug'' tox environment. Here's an example, passing the name of a test since you'll normally only want to run the test that hits your breakpoint:
$ tox -e debug aodh.tests.test_bin
For reference, the
debug
tox environment implements the instructions here: https://wiki.openstack.org/wiki/Testr#Debugging_.28pdb.29_TestsThere is a growing suite of tests which use a tool called gabbi to test and validate the behavior of the Aodh API. These tests are run when using the usual
py27
tox target but if desired they can be run by themselves:$ tox -e gabbi
The YAML files used to drive the gabbi tests can be found in
aodh/tests/gabbi/gabbits
. If you are adding to or adjusting the API you should consider adding tests here.