Jump to: navigation, search

Difference between revisions of "Testing"

m (Unit Tests: Added note about bug 1274135)
(IntegrationTests: Refined into manual and automated categories, added initial content)
Line 42: Line 42:
 
=== IntegrationTests ===
 
=== IntegrationTests ===
  
 +
==== Manual Integration Tests ====
  
 +
[[DevStack]] produces a running system, with all the processes running under `screen`.
 +
<pre><nowiki>
 +
screen -r
 +
</nowiki></pre>
 +
will re-attach to that screen session (if it is the only one).  For manual system testing: change your code in place and recycle the relevant processes, in the right order.  You have to understand the code in order to know which are the relevant processes and what is the right order.
 +
 +
==== Automated Integration Tests ====
 +
 +
See tempest.
  
 
== Running Swift Tests ==
 
== Running Swift Tests ==
  
 
Swift has functional tests, functional nose tests, and unit tests available in the source in the test directory. At Rackspace we test several environments including a staging area with 36 storage nodes.
 
Swift has functional tests, functional nose tests, and unit tests available in the source in the test directory. At Rackspace we test several environments including a staging area with 36 storage nodes.

Revision as of 02:00, 19 February 2014

Testing OpenStack Projects

Projects generally have three categories of tests that commits are must pass before being ready for review:

  • Unit Tests
Self contained in each project
  • Style Checks
Based on flake8 and hacking
  • Integration Tests
Part of tempest

Unit Tests

It is suggested you install tox [1] with pip [2].

`[apt-get | yum] install python-pip`

`pip install tox` (`pip install --upgrade tox` - upgrades tox)

At the moment there is a bug in the latest tox; see https://bugs.launchpad.net/openstack-ci/+bug/1274135 for a workaround; when installing from scratch, install a suitable downlevel version.

Sample tox.ini file https://github.com/openstack/nova/blob/master/tox.ini

There will be a tox.ini file in the root directory of every project.

Within the tox.ini file you might see any of the following envlist options:

[tox]

envlist = py26,py27,py33,pep8,pylint

or others.

Tox

Why does tox take so long to run? The reason tox takes a long time is two-fold: On the first run it has to create a virtual environment, which can take anywhere from 5 to 30+ minutes depending on the project and the system. The other reason is that it just takes a long time to run all of the test cases in some of the projects.

Style Checks

Style checks can be run via tox with `tox -epep8` or manually using `flake8`.

IntegrationTests

Manual Integration Tests

DevStack produces a running system, with all the processes running under `screen`.

screen -r

will re-attach to that screen session (if it is the only one). For manual system testing: change your code in place and recycle the relevant processes, in the right order. You have to understand the code in order to know which are the relevant processes and what is the right order.

Automated Integration Tests

See tempest.

Running Swift Tests

Swift has functional tests, functional nose tests, and unit tests available in the source in the test directory. At Rackspace we test several environments including a staging area with 36 storage nodes.