Tests the API in XML mode.
This form of testing has been nearly available for awhile but was not turned on because it will increase the time of a full tox test run by eight seconds. However there has recently been new features which do not work at all with XML, so the time loss seems like a silly reason to not gate on this. implements blueprint test-with-xml Change-Id: I98d892bb5c1a0c16425f80a28a296c70120318c8
This commit is contained in:
parent
dc0a82131d
commit
0fc4600e01
4
etc/tests/xml.localhost.test.conf
Normal file
4
etc/tests/xml.localhost.test.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"include-files": ["localhost.test.conf"],
|
||||||
|
"reddwarf_client_cls": "reddwarfclient.xml.ReddwarfXmlClient"
|
||||||
|
}
|
@ -63,6 +63,7 @@ from reddwarf.tests.util import create_dbaas_client
|
|||||||
from reddwarf.tests.util import create_nova_client
|
from reddwarf.tests.util import create_nova_client
|
||||||
from reddwarf.tests.util import process
|
from reddwarf.tests.util import process
|
||||||
from reddwarf.tests.util.users import Requirements
|
from reddwarf.tests.util.users import Requirements
|
||||||
|
from reddwarf.tests.util import skip_if_xml
|
||||||
from reddwarf.tests.util import string_in_list
|
from reddwarf.tests.util import string_in_list
|
||||||
from reddwarf.tests.util import poll_until
|
from reddwarf.tests.util import poll_until
|
||||||
from reddwarf.tests.util.check import AttrCheck
|
from reddwarf.tests.util.check import AttrCheck
|
||||||
@ -233,6 +234,9 @@ def test_delete_instance_not_found():
|
|||||||
runs_after_groups=[tests.PRE_INSTANCES])
|
runs_after_groups=[tests.PRE_INSTANCES])
|
||||||
class CreateInstanceQuotaTest(unittest.TestCase):
|
class CreateInstanceQuotaTest(unittest.TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
skip_if_xml()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
dbaas_admin.quota.update(instance_info.user.tenant,
|
dbaas_admin.quota.update(instance_info.user.tenant,
|
||||||
CONFIG.reddwarf_max_instances_per_user,
|
CONFIG.reddwarf_max_instances_per_user,
|
||||||
|
@ -34,6 +34,7 @@ from reddwarf.tests.api.databases import TestDatabases
|
|||||||
from reddwarf.tests.api.instances import GROUP_START
|
from reddwarf.tests.api.instances import GROUP_START
|
||||||
from reddwarf.tests.api.instances import instance_info
|
from reddwarf.tests.api.instances import instance_info
|
||||||
from reddwarf.tests import util
|
from reddwarf.tests import util
|
||||||
|
from reddwarf.tests.util import skip_if_xml
|
||||||
from reddwarf.tests.util import test_config
|
from reddwarf.tests.util import test_config
|
||||||
from reddwarf.tests.api.databases import TestMysqlAccess
|
from reddwarf.tests.api.databases import TestMysqlAccess
|
||||||
|
|
||||||
|
@ -198,6 +198,11 @@ def process(cmd):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def skip_if_xml():
|
||||||
|
if "xml" in CONFIG.values.get('reddwarf_client_cls', ''):
|
||||||
|
raise SkipTest("This feature does not work with XML.")
|
||||||
|
|
||||||
|
|
||||||
def string_in_list(str, substr_list):
|
def string_in_list(str, substr_list):
|
||||||
"""Returns True if the string appears in the list."""
|
"""Returns True if the string appears in the list."""
|
||||||
return any([str.find(x) >= 0 for x in substr_list])
|
return any([str.find(x) >= 0 for x in substr_list])
|
||||||
|
13
run_tests.py
13
run_tests.py
@ -89,6 +89,16 @@ def initialize_fakes(app):
|
|||||||
time.sleep = event_simulator_sleep
|
time.sleep = event_simulator_sleep
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args_for_test_config():
|
||||||
|
for index in range(len(sys.argv)):
|
||||||
|
arg = sys.argv[index]
|
||||||
|
print(arg)
|
||||||
|
if arg[:14] == "--test-config=":
|
||||||
|
del sys.argv[index]
|
||||||
|
return arg[14:]
|
||||||
|
return 'etc/tests/localhost.test.conf'
|
||||||
|
|
||||||
|
|
||||||
def replace_poll_until():
|
def replace_poll_until():
|
||||||
from reddwarf.common import utils as rd_utils
|
from reddwarf.common import utils as rd_utils
|
||||||
from reddwarf.tests import util as test_utils
|
from reddwarf.tests import util as test_utils
|
||||||
@ -109,7 +119,8 @@ if __name__ == "__main__":
|
|||||||
# Swap out WSGI, httplib, and several sleep functions with test doubles.
|
# Swap out WSGI, httplib, and several sleep functions with test doubles.
|
||||||
initialize_fakes(app)
|
initialize_fakes(app)
|
||||||
# Initialize the test configuration.
|
# Initialize the test configuration.
|
||||||
CONFIG.load_from_file('etc/tests/localhost.test.conf')
|
test_config_file = parse_args_for_test_config()
|
||||||
|
CONFIG.load_from_file(test_config_file)
|
||||||
|
|
||||||
from reddwarf.tests.api import limits
|
from reddwarf.tests.api import limits
|
||||||
from reddwarf.tests.api import flavors
|
from reddwarf.tests.api import flavors
|
||||||
|
5
tox.ini
5
tox.ini
@ -7,6 +7,7 @@ deps = -r{toxinidir}/tools/pip-requires
|
|||||||
-r{toxinidir}/tools/test-requires
|
-r{toxinidir}/tools/test-requires
|
||||||
setuptools_git>=0.4
|
setuptools_git>=0.4
|
||||||
commands = {envpython} run_tests.py
|
commands = {envpython} run_tests.py
|
||||||
|
{envpython} run_tests.py --test-config=etc/tests/xml.localhost.test.conf
|
||||||
python setup.py testr --slowest
|
python setup.py testr --slowest
|
||||||
|
|
||||||
[tox:jenkins]
|
[tox:jenkins]
|
||||||
@ -23,8 +24,8 @@ basepython = python2.7
|
|||||||
commands =
|
commands =
|
||||||
coverage erase
|
coverage erase
|
||||||
python setup.py testr --coverage
|
python setup.py testr --coverage
|
||||||
coverage run -a run_tests.py
|
coverage run -a run_tests.py
|
||||||
coverage html
|
coverage html
|
||||||
coverage report
|
coverage report
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user