Switching Poppy test to use ostestr (OpenStack Testr)
Change-Id: Iec921d21f3325e92462c7a2b40d748db8f85cdff
This commit is contained in:
parent
00f40d9837
commit
2140f6def0
@ -2,7 +2,7 @@
|
|||||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
|
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
|
||||||
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tests} $LISTOPT $IDOPTION
|
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tests/unit} $LISTOPT $IDOPTION
|
||||||
|
|
||||||
test_id_option=--load-list $IDFILE
|
test_id_option=--load-list $IDFILE
|
||||||
test_list_option=--list
|
test_list_option=--list
|
||||||
|
@ -129,6 +129,8 @@ class ServiceController(base.ServiceBase):
|
|||||||
Map a poppy service name to a provider's service name so it
|
Map a poppy service name to a provider's service name so it
|
||||||
can comply provider's naming convention.
|
can comply provider's naming convention.
|
||||||
"""
|
"""
|
||||||
|
if isinstance(service_name, bytes):
|
||||||
|
service_name = service_name.decode("utf-8")
|
||||||
if MAXCDN_NAMING_REGEX.match(service_name):
|
if MAXCDN_NAMING_REGEX.match(service_name):
|
||||||
return service_name
|
return service_name
|
||||||
else:
|
else:
|
||||||
|
11
setup.cfg
11
setup.cfg
@ -76,17 +76,6 @@ poppy.provider.akamai.cert_info_storage =
|
|||||||
[wheel]
|
[wheel]
|
||||||
universal = 1
|
universal = 1
|
||||||
|
|
||||||
[nosetests]
|
|
||||||
cover-branches = true
|
|
||||||
cover-erase = true
|
|
||||||
cover-inclusive = true
|
|
||||||
#cover-min-percentage = 100
|
|
||||||
cover-package = poppy
|
|
||||||
#match = ^test
|
|
||||||
where = tests
|
|
||||||
with-coverage = true
|
|
||||||
verbosity=2
|
|
||||||
|
|
||||||
; Disabled: Causes a bug in testtools to manifest.
|
; Disabled: Causes a bug in testtools to manifest.
|
||||||
; Trigger: self.assertX(condition), where condition == False.
|
; Trigger: self.assertX(condition), where condition == False.
|
||||||
;
|
;
|
||||||
|
@ -4,9 +4,9 @@ dnspython
|
|||||||
fixtures
|
fixtures
|
||||||
hacking
|
hacking
|
||||||
mock
|
mock
|
||||||
nose
|
|
||||||
openstack.nose_plugin
|
openstack.nose_plugin
|
||||||
oslotest>=1.9.0
|
oslotest>=1.9.0
|
||||||
|
os-testr>=0.7.0 # Apache-2.0
|
||||||
requests-mock
|
requests-mock
|
||||||
testrepository
|
testrepository
|
||||||
testtools
|
testtools
|
||||||
|
@ -312,6 +312,8 @@ class TestFlowRuns(base.TestCase):
|
|||||||
|
|
||||||
self.patch_delete_flow(service_controller, storage_controller,
|
self.patch_delete_flow(service_controller, storage_controller,
|
||||||
dns_controller)
|
dns_controller)
|
||||||
|
storage_controller.get_service = mock.Mock(
|
||||||
|
return_value=service_obj)
|
||||||
engines.run(delete_service.delete_service(), store=kwargs)
|
engines.run(delete_service.delete_service(), store=kwargs)
|
||||||
|
|
||||||
def test_purge_flow_normal(self):
|
def test_purge_flow_normal(self):
|
||||||
|
@ -19,6 +19,7 @@ import uuid
|
|||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from poppy import bootstrap
|
||||||
from poppy.manager.default import driver
|
from poppy.manager.default import driver
|
||||||
from poppy.manager.default import flavors
|
from poppy.manager.default import flavors
|
||||||
from poppy.model import flavor
|
from poppy.model import flavor
|
||||||
@ -42,6 +43,9 @@ class DefaultManagerFlavorTests(base.TestCase):
|
|||||||
os.path.dirname(os.path.dirname(__file__)))))
|
os.path.dirname(os.path.dirname(__file__)))))
|
||||||
conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf')
|
conf_path = os.path.join(tests_path, 'etc', 'default_functional.conf')
|
||||||
cfg.CONF(args=[], default_config_files=[conf_path])
|
cfg.CONF(args=[], default_config_files=[conf_path])
|
||||||
|
cfg.CONF.register_opts(bootstrap._DEFAULT_OPTIONS)
|
||||||
|
cfg.CONF.register_opts(bootstrap._DRIVER_OPTIONS,
|
||||||
|
group=bootstrap._DRIVER_GROUP)
|
||||||
|
|
||||||
manager_driver = driver.DefaultManagerDriver(cfg.CONF,
|
manager_driver = driver.DefaultManagerDriver(cfg.CONF,
|
||||||
mock_driver,
|
mock_driver,
|
||||||
|
@ -27,8 +27,8 @@ class TestDomain(base.TestCase):
|
|||||||
@ddt.unpack
|
@ddt.unpack
|
||||||
@ddt.data({'domain_name': 'www.mydomain.com',
|
@ddt.data({'domain_name': 'www.mydomain.com',
|
||||||
'changed_domain_name': 'www.changed-domain.com'},
|
'changed_domain_name': 'www.changed-domain.com'},
|
||||||
{'domain_name': u'www.düsseldorf-Lörick.com',
|
{'domain_name': u'www.düsseldorf-Lörick.com'.encode("utf-8"),
|
||||||
'changed_domain_name': u'www.düsseldorf.com'
|
'changed_domain_name': u'www.düsseldorf.com'.encode("utf-8")
|
||||||
},
|
},
|
||||||
{'domain_name': u'WWW.UPPERCASE.COM',
|
{'domain_name': u'WWW.UPPERCASE.COM',
|
||||||
'changed_domain_name': u'WWW.UPPERCASE-CHANGED.COM'
|
'changed_domain_name': u'WWW.UPPERCASE-CHANGED.COM'
|
||||||
|
@ -27,8 +27,8 @@ class TestOrigin(base.TestCase):
|
|||||||
@ddt.unpack
|
@ddt.unpack
|
||||||
@ddt.data({'origin_url': 'www.mydomain.com',
|
@ddt.data({'origin_url': 'www.mydomain.com',
|
||||||
'changed_origin_url': 'www.changed-domain.com'},
|
'changed_origin_url': 'www.changed-domain.com'},
|
||||||
{'origin_url': u'www.düsseldorf-Lörick.com',
|
{'origin_url': u'www.düsseldorf-Lörick.com'.encode("utf-8"),
|
||||||
'changed_origin_url': u'www.düsseldorf.com'})
|
'changed_origin_url': u'www.düsseldorf.com'.encode("utf-8")})
|
||||||
def test_origin(self, origin_url, changed_origin_url):
|
def test_origin(self, origin_url, changed_origin_url):
|
||||||
|
|
||||||
port = 80
|
port = 80
|
||||||
|
@ -289,7 +289,8 @@ class TestServices(base.TestCase):
|
|||||||
self.assertEqual(controller._map_service_name(service_name),
|
self.assertEqual(controller._map_service_name(service_name),
|
||||||
service_name)
|
service_name)
|
||||||
|
|
||||||
@ddt.data(u'www.düsseldorf-Lörick.com', 'yahoo%_notvalid')
|
@ddt.data(u'www.düsseldorf-Lörick.com'.encode("utf-8"),
|
||||||
|
'yahoo%_notvalid')
|
||||||
@mock.patch.object(driver.CDNProvider, 'client',
|
@mock.patch.object(driver.CDNProvider, 'client',
|
||||||
new=fake_maxcdn_api_client())
|
new=fake_maxcdn_api_client())
|
||||||
def test_map_service_name_with_hash(self, service_name):
|
def test_map_service_name_with_hash(self, service_name):
|
||||||
|
@ -74,7 +74,8 @@ class MockProviderServicesTest(base.TestCase):
|
|||||||
response = self.sc.create(service_obj)
|
response = self.sc.create(service_obj)
|
||||||
self.assertTrue(response is not None)
|
self.assertTrue(response is not None)
|
||||||
|
|
||||||
@ddt.data("my_mock_service.com", u'www.düsseldorf-Lörick.com')
|
@ddt.data("my_mock_service.com",
|
||||||
|
u'www.düsseldorf-Lörick.com'.encode('utf-8'))
|
||||||
def test__map_service_name(self, service_name):
|
def test__map_service_name(self, service_name):
|
||||||
self.assertTrue(self.sc._map_service_name(service_name),
|
self.assertTrue(self.sc._map_service_name(service_name),
|
||||||
service_name)
|
service_name)
|
||||||
|
8
tools/ostestr_compat_shim.sh
Executable file
8
tools/ostestr_compat_shim.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# preserve old behavior of using an arg as a regex when '--' is not present
|
||||||
|
case $@ in
|
||||||
|
(*--*) ostestr $@;;
|
||||||
|
('') ostestr;;
|
||||||
|
(*) ostestr --regex "$@"
|
||||||
|
esac
|
51
tox.ini
51
tox.ini
@ -1,25 +1,38 @@
|
|||||||
[tox]
|
[tox]
|
||||||
minversion = 1.6
|
minversion = 1.6
|
||||||
envlist = py34,py27,pypy,pep8
|
envlist = py34,py27,functional,functional-py34,pypy,pep8
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
# Customize pip command, add -U to force updates.
|
# Customize pip command, add -U to force updates.
|
||||||
install_command = pip install -U {opts} {packages}
|
|
||||||
setenv = VIRTUAL_ENV={envdir}
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
LC_ALL = en_US.UTF-8
|
LC_ALL = en_US.UTF-8
|
||||||
NOSE_WITH_OPENSTACK=1
|
install_command = pip install -U {opts} {packages}
|
||||||
NOSE_OPENSTACK_COLOR=1
|
passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
|
||||||
NOSE_OPENSTACK_RED=0.05
|
|
||||||
NOSE_OPENSTACK_YELLOW=0.025
|
|
||||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
|
||||||
NOSE_OPENSTACK_STDOUT=1
|
|
||||||
PYTHONDONTWRITEBYTECODE=1
|
|
||||||
deps = -r{toxinidir}/requirements/requirements.txt
|
deps = -r{toxinidir}/requirements/requirements.txt
|
||||||
-r{toxinidir}/tests/test-requirements.txt
|
-r{toxinidir}/tests/test-requirements.txt
|
||||||
commands = pip install git+https://github.com/stackforge/opencafe.git#egg=cafe
|
commands = pip install git+https://github.com/stackforge/opencafe.git#egg=cafe
|
||||||
nosetests unit functional {posargs:--nologcapture}
|
{toxinidir}/tools/ostestr_compat_shim.sh {posargs}
|
||||||
|
|
||||||
|
[testenv:common]
|
||||||
|
# Fake job to define environment variables shared between dsvm/non-dsvm jobs
|
||||||
|
setenv = OS_TEST_TIMEOUT=180
|
||||||
|
|
||||||
|
[testenv:functional]
|
||||||
|
basepython = python2.7
|
||||||
|
setenv = {[testenv]setenv}
|
||||||
|
{[testenv:common]setenv}
|
||||||
|
OS_TEST_PATH=./tests/functional
|
||||||
|
OS_LOG_PATH={env:OS_LOG_PATH:{homedir}/.poppy/logs}
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
|
||||||
|
[testenv:functional-py34]
|
||||||
|
basepython = python3.4
|
||||||
|
setenv = {[testenv:functional]setenv}
|
||||||
|
deps =
|
||||||
|
{[testenv:functional]deps}
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
commands = flake8
|
commands = flake8
|
||||||
@ -47,7 +60,11 @@ commands =
|
|||||||
python setup.py build_sphinx -E -a -b coverage
|
python setup.py build_sphinx -E -a -b coverage
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
setenv = NOSE_WITH_COVERAGE=1
|
install_command = pip install -U {opts} {packages}
|
||||||
|
basepython = python2.7
|
||||||
|
commands =
|
||||||
|
python setup.py testr --coverage --testr-args='{posargs}'
|
||||||
|
coverage report
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
@ -66,15 +83,11 @@ setenv = CAFE_CONFIG_FILE_PATH={homedir}/.poppy/tests.conf
|
|||||||
CAFE_ROOT_LOG_PATH={homedir}/.poppy/logs
|
CAFE_ROOT_LOG_PATH={homedir}/.poppy/logs
|
||||||
CAFE_TEST_LOG_PATH={homedir}/.poppy/logs
|
CAFE_TEST_LOG_PATH={homedir}/.poppy/logs
|
||||||
|
|
||||||
NOSE_WITH_OPENSTACK=1
|
OS_TEST_PATH=./tests/api
|
||||||
NOSE_OPENSTACK_COLOR=1
|
OS_LOG_PATH={env:OS_LOG_PATH:{homedir}/.poppy/logs}
|
||||||
NOSE_OPENSTACK_RED=0.05
|
|
||||||
NOSE_OPENSTACK_YELLOW=0.025
|
|
||||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
|
||||||
NOSE_OPENSTACK_STDOUT=1
|
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
pip install git+https://github.com/openstack/opencafe.git#egg=cafe
|
pip install git+https://github.com/openstack/opencafe.git#egg=cafe
|
||||||
./run_poppy.sh -d
|
#./run_poppy.sh -d
|
||||||
|
|
||||||
nosetests api --nologcapture
|
{toxinidir}/tools/ostestr_compat_shim.sh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user