Add documentation on how to run tests

Added a testing page to the documentation.

This includes information on:
 * Running PEP8 checks
 * Running unit tests
 * Running functional tests

Closes-bug:#1511731
Change-Id: I4a5cf4be98f32455e36ea7d6a45b18afca043809
This commit is contained in:
Sergey Turivnyi 2015-11-02 16:16:59 +02:00
parent b66f5e8dd6
commit f5c478b027
2 changed files with 68 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Contents
api_v1
cli
contributing
testing
Indices and tables
==================

67
doc/source/testing.rst Normal file
View File

@ -0,0 +1,67 @@
.. _testing:
=======
Testing
=======
Python Guideline Enforcement
............................
All code has to pass the pep8 style guideline to merge into OpenStack, to
validate the code against these guidelines you can run::
tox -e pep8
Unit Testing
............
It is strongly encouraged to run the unit tests locally under one or more
test environments prior to submitting a patch. To run all the recommended
environments sequentially and pep8 style guideline run::
tox
You can also selectively pick specific test environments by listing your
chosen environments after a -e flag::
tox -e py27,py33,py34,pep8
.. note::
Tox sets up virtual environment and installs all necessary dependencies.
Sharing the environment with devstack testing is not recommended due to
conflicting configuration with system dependencies.
Functional Testing
..................
Functional testing assumes the existence of the script run_functional.sh in the
python-ironicclient/tools directory. The script run_functional.sh generates
test.conf file. To run functional tests just run ./run_functional.sh.
Also, the test.conf file could be created manually or generated from
environment variables. It assumes the existence of an openstack
cloud installation along with admin credentials. The test.conf file lives in
ironicclient/tests/functional/ directory. To run functional tests in that way
create test.conf manually and run::
tox -e functional
An example test.conf file::
[functional]
api_version = 1
os_auth_url=http://192.168.0.2:5000/v2.0/
os_username=admin
os_password=admin
os_tenant_name=admin
If you are testing ironic in standalone mode, only the parameters
'auth_strategy', 'os_auth_token' and 'ironic_url' are required;
all others will be ignored.
An example test.conf file for standalone host::
[functional]
auth_strategy = noauth
os_auth_token = fake
ironic_url = http://10.0.0.2:6385