summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Schwede <cschwede@redhat.com>2015-06-02 19:51:39 +0000
committerAlistair Coles <alistair.coles@hp.com>2015-10-22 12:18:35 +0100
commit2914514e2464c4a9227bbbf67f5a08eda7b7ad06 (patch)
tree9b719812127b6b63b464fd7436b0515658a46b38
parented35e1fbee7176722d7e4c818b5c879bb9098169 (diff)
downloadswift-2914514e2464c4a9227bbbf67f5a08eda7b7ad06.tar.gz
Fix testing issues
When functional tests are run in tox and an exception is raised when connecting to Swift (for example: Swift not running, missing python-keystoneclient package used by python-swiftclient) 0 tests are executed, but tox returns a success. An exception is raised during tests, caused by a missing python-keystoneclient in python-swiftclient. Instead of adding python-keystoneclient as a dependency in python-swiftclient the package is added to the test-requirements.txt in Swift itself. Note that adding python-keystoneclient to the test-requirements in python-swiftclient is not sufficient (it's already in there). The exception in setup_package() is catched by the openstack.nose_plugin, thus disabling this plugin for now as well. Also fixing two test errors seen on the gate regarding the tempurl middleware. There was also an update to tox, environment variables were no longer passed with versions >= 2.0 (http://tox.readthedocs.org/en/latest/changelog.html). Swift test environment variables have been added to the passenv to re-enable the former behavior, as well as environment variables required to pass proxy settings. This also led to skipped tempauth tests, and together with the missing python-keystoneclient no tests were executed. Related-Bug: 1461440 Related-Bug: 1455102 Co-Authored-By: Alistair Coles <alistair.coles@hp.com> Change-Id: Ideea071017d04912c60ed0bc76532adbb446c31d (cherry picked from commit f1f4bb30cd8ad930ddb7a232b2744b48e35a0480 with modified python-keystoneclient version specifiers in test-requirements.txt)
-rw-r--r--doc/source/development_guidelines.rst15
-rw-r--r--test-requirements.txt2
-rw-r--r--test/functional/tests.py4
-rw-r--r--tox.ini7
4 files changed, 18 insertions, 10 deletions
diff --git a/doc/source/development_guidelines.rst b/doc/source/development_guidelines.rst
index 241eda6cf..da978c50c 100644
--- a/doc/source/development_guidelines.rst
+++ b/doc/source/development_guidelines.rst
@@ -44,13 +44,24 @@ To execute the unit tests:
If you installed using: `cd ~/swift; sudo python setup.py develop`,
you may need to do: `cd ~/swift; sudo chown -R swift:swift swift.egg-info`
prior to running tox.
- If you ever encounter DistributionNotFound, try to use `tox --recreate`
- or removing .tox directory to force tox to recreate the dependency list
* Optionally, run only specific tox builds:
- `tox -e pep8,py26`
+.. note::
+ As of tox version 2.0.0, most environment variables are not automatically
+ passed to the test environment. Swift's tox.ini overrides this default
+ behavior so that variable names matching SWIFT_* and *_proxy will be passed,
+ but you may need to run tox --recreate for this to take effect after
+ upgrading from tox<2.0.0.
+
+ Conversely, if you do not want those environment variables to be passed to
+ the test environment then you will need to unset them before calling tox.
+
+ Also, if you ever encounter DistributionNotFound, try to use `tox --recreate`
+ or remove the .tox directory to force tox to recreate the dependency list.
+
The functional tests may be executed against a :doc:`development_saio` or
other running Swift cluster using the command:
diff --git a/test-requirements.txt b/test-requirements.txt
index 8c617baac..611a81a0a 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -7,9 +7,9 @@ hacking>=0.8.0,<0.9
coverage
nose
nosexcover
-openstack.nose_plugin
nosehtmloutput
oslosphinx
sphinx>=1.1.2,<1.2
mock>=1.0
python-swiftclient
+python-keystoneclient<1.4.0,>=1.2.0
diff --git a/test/functional/tests.py b/test/functional/tests.py
index 1c342f0df..27c081a8b 100644
--- a/test/functional/tests.py
+++ b/test/functional/tests.py
@@ -31,7 +31,7 @@ from nose import SkipTest
from swift.common.http import is_success, is_client_error
from test.functional import normalized_urls, load_constraint, cluster_info
-from test.functional import check_response, retry
+from test.functional import check_response, retry, requires_acls
import test.functional as tf
from test.functional.swift_test_client import Account, Connection, File, \
ResponseError
@@ -3073,6 +3073,7 @@ class TestContainerTempurl(Base):
parms=parms)
self.assert_status([401])
+ @requires_acls
def test_tempurl_keys_visible_to_account_owner(self):
if not tf.cluster_info.get('tempauth'):
raise SkipTest('TEMP AUTH SPECIFIC TEST')
@@ -3080,6 +3081,7 @@ class TestContainerTempurl(Base):
self.assertEqual(metadata.get('tempurl_key'), self.env.tempurl_key)
self.assertEqual(metadata.get('tempurl_key2'), self.env.tempurl_key2)
+ @requires_acls
def test_tempurl_keys_hidden_from_acl_readonly(self):
if not tf.cluster_info.get('tempauth'):
raise SkipTest('TEMP AUTH SPECIFIC TEST')
diff --git a/tox.ini b/tox.ini
index 96e32f87a..65718f8cb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,18 +7,13 @@ skipsdist = True
usedevelop = True
install_command = pip install --allow-external netifaces --allow-insecure netifaces -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
- NOSE_WITH_OPENSTACK=1
- NOSE_OPENSTACK_COLOR=1
- NOSE_OPENSTACK_RED=0.05
- NOSE_OPENSTACK_YELLOW=0.025
- NOSE_OPENSTACK_SHOW_ELAPSED=1
- NOSE_OPENSTACK_STDOUT=1
NOSE_WITH_COVERAGE=1
NOSE_COVER_BRANCHES=1
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = nosetests {posargs:test/unit}
+passenv = SWIFT_* *_proxy
[testenv:cover]
setenv = VIRTUAL_ENV={envdir}