From f5c478b027f081a7e91231aecf8242dcacaee3d4 Mon Sep 17 00:00:00 2001 From: Sergey Turivnyi Date: Mon, 2 Nov 2015 16:16:59 +0200 Subject: [PATCH] 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 --- doc/source/index.rst | 1 + doc/source/testing.rst | 67 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 doc/source/testing.rst diff --git a/doc/source/index.rst b/doc/source/index.rst index bef6b30c6..af7c23364 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -15,6 +15,7 @@ Contents api_v1 cli contributing + testing Indices and tables ================== diff --git a/doc/source/testing.rst b/doc/source/testing.rst new file mode 100644 index 000000000..f45e1d61b --- /dev/null +++ b/doc/source/testing.rst @@ -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