Jump to: navigation, search

Difference between revisions of "Testing"

(Testing OpenStack Projects)
(Add comments about style checks and tempest)
Line 2: Line 2:
 
= Testing [[OpenStack]] Projects =
 
= Testing [[OpenStack]] Projects =
  
Unit tests are available for each project, and testing also involves installing and running OpenStack Compute or Object Store and reporting any oddities you see.
+
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 [http://flake8.readthedocs.org/en/2.0/ flake8] and [https://github.com/openstack-dev/hacking hacking]
 +
* Integration Tests
 +
:Part of [https://github.com/openstack/tempest tempest]
 +
 
 +
=== Unit Tests ===
  
 
It is suggested you install tox [http://testrun.org/tox/latest/] with pip [http://www.pip-installer.org/en/latest/].
 
It is suggested you install tox [http://testrun.org/tox/latest/] with pip [http://www.pip-installer.org/en/latest/].
Line 22: Line 31:
 
or others.
 
or others.
  
Tempest also has integration tests.
+
=== Style Checks ===
 +
Style checks can be run via tox with `tox -epep8` or manually using `flake8`.
 +
 
 +
=== IntegrationTests ===
 +
 
 +
 
  
 
== Running Swift Tests ==
 
== Running Swift Tests ==

Revision as of 00:10, 19 June 2013

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)

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.

Style Checks

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

IntegrationTests

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.

Running Nova Tests

As a prerequisite to running tests for OpenStack Compute (Nova), redis must be installed and running.

To run tests, run the run_tests.sh script in the Nova source code directory. Nose tests in Nova will not work in the Austin release but will work in the Bexar release. Look at ./test/functionalnosetests/swift_testing.py for an explanation on how the test script decides whether functional tests are skipped or not based on the availability of configuration information.

If the tests are successfully running, you see a series of periods (.). Typically the tests take just a minute or two to run. If there is an Error, you see an E. When errors occur, check either /var/log/syslog or /var/log/messages to see if there are any errors in those logs.