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:
Tim Simpson 2013-03-06 18:24:17 -06:00
parent dc0a82131d
commit 0fc4600e01
6 changed files with 29 additions and 3 deletions

View File

@ -0,0 +1,4 @@
{
"include-files": ["localhost.test.conf"],
"reddwarf_client_cls": "reddwarfclient.xml.ReddwarfXmlClient"
}

View File

@ -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 process
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 poll_until
from reddwarf.tests.util.check import AttrCheck
@ -233,6 +234,9 @@ def test_delete_instance_not_found():
runs_after_groups=[tests.PRE_INSTANCES])
class CreateInstanceQuotaTest(unittest.TestCase):
def setUp(self):
skip_if_xml()
def tearDown(self):
dbaas_admin.quota.update(instance_info.user.tenant,
CONFIG.reddwarf_max_instances_per_user,

View File

@ -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 instance_info
from reddwarf.tests import util
from reddwarf.tests.util import skip_if_xml
from reddwarf.tests.util import test_config
from reddwarf.tests.api.databases import TestMysqlAccess

View File

@ -198,6 +198,11 @@ def process(cmd):
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):
"""Returns True if the string appears in the list."""
return any([str.find(x) >= 0 for x in substr_list])

View File

@ -89,6 +89,16 @@ def initialize_fakes(app):
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():
from reddwarf.common import utils as rd_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.
initialize_fakes(app)
# 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 flavors

View File

@ -7,6 +7,7 @@ deps = -r{toxinidir}/tools/pip-requires
-r{toxinidir}/tools/test-requires
setuptools_git>=0.4
commands = {envpython} run_tests.py
{envpython} run_tests.py --test-config=etc/tests/xml.localhost.test.conf
python setup.py testr --slowest
[tox:jenkins]
@ -23,8 +24,8 @@ basepython = python2.7
commands =
coverage erase
python setup.py testr --coverage
coverage run -a run_tests.py
coverage html
coverage run -a run_tests.py
coverage html
coverage report