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 f1f4bb30cd
with modified python-keystoneclient version specifiers in test-requirements.txt)
This commit is contained in:
Christian Schwede 2015-06-02 19:51:39 +00:00 committed by Alistair Coles
parent ed35e1fbee
commit 2914514e24
4 changed files with 18 additions and 10 deletions

View File

@ -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:

View File

@ -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

View File

@ -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')

View File

@ -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}