From 64fecf712fab7f9c8ed980b93a98bd19b8e42939 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Wed, 2 Jul 2014 00:35:12 +0000 Subject: [PATCH] Add a gate-specific tox env for functional tests The functional gate jobs (*-neutron-dsvm-functional) need special configuration (e.g. OS_SUDO_TESTING, OS_ROOTWRAP_CMD) to run tests. This patch adds a new gate-specific tox env (tox -e dsvm-functional) that sets the appropriate values and allows easy duplication of the results of the upstream job on a host that has successfully run devstack with neutron enabled. A new configuration option, OS_FAIL_ON_MISSING_DEPS, is also set by the dsvm-functional tox env to ensure that dependency failures will result in failures rather than skips when run in the gate. Change-Id: Idbfef1ba72ed129a3021509c7969e2685b8a6d09 Partial-bug: #1336172 --- TESTING.rst | 28 +++++++++++++++++++--------- tox.ini | 8 ++++++++ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/TESTING.rst b/TESTING.rst index 0d6814e8e..64a217f83 100644 --- a/TESTING.rst +++ b/TESTING.rst @@ -4,16 +4,16 @@ Testing Neutron Overview -------- -The unit tests are meant to cover as much code as possible and should -be executed without the service running. They are designed to test -the various pieces of the neutron tree to make sure any new changes -don't break existing functionality. +The unit tests (neutron/test/unit/) are meant to cover as much code as +possible and should be executed without the service running. They are +designed to test the various pieces of the neutron tree to make sure +any new changes don't break existing functionality. -The functional tests are intended to validate actual system -interaction. Mocks should be used sparingly, if at all. Care -should be taken to ensure that existing system resources are not -modified and that resources created in tests are properly cleaned -up. +The functional tests (neutron/tests/functional/) are intended to +validate actual system interaction. Mocks should be used sparingly, +if at all. Care should be taken to ensure that existing system +resources are not modified and that resources created in tests are +properly cleaned up. Development process ------------------- @@ -100,6 +100,16 @@ Neutron source code:: tox +To run functional tests that do not require sudo privileges or +specific-system dependencies:: + + tox -e functional + +To run all the functional tests in an environment that has been configured +by devstack to support sudo and system-specific dependencies:: + + tox -e dsvm-functional + For more information on the standard Tox-based test infrastructure used by OpenStack and how to do some common test/debugging procedures with Testr, see this wiki page: diff --git a/tox.ini b/tox.ini index d459887c3..5891515f4 100644 --- a/tox.ini +++ b/tox.ini @@ -18,6 +18,14 @@ setenv = OS_TEST_PATH=./neutron/tests/functional commands = python setup.py testr --slowest --testr-args='{posargs}' +[testenv:dsvm-functional] +setenv = OS_TEST_PATH=./neutron/tests/functional + OS_SUDO_TESTING=1 + OS_ROOTWRAP_CMD=sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf + OS_FAIL_ON_MISSING_DEPS=1 +commands = + python setup.py testr --slowest --testr-args='{posargs}' + [tox:jenkins] sitepackages = True downloadcache = ~/cache/pip