diff --git a/etc/tests/xml.localhost.test.conf b/etc/tests/xml.localhost.test.conf new file mode 100644 index 0000000000..d7590f8b20 --- /dev/null +++ b/etc/tests/xml.localhost.test.conf @@ -0,0 +1,4 @@ +{ + "include-files": ["localhost.test.conf"], + "reddwarf_client_cls": "reddwarfclient.xml.ReddwarfXmlClient" +} diff --git a/reddwarf/tests/api/instances.py b/reddwarf/tests/api/instances.py index 8d43455be3..a46ea8eccf 100644 --- a/reddwarf/tests/api/instances.py +++ b/reddwarf/tests/api/instances.py @@ -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, diff --git a/reddwarf/tests/api/users.py b/reddwarf/tests/api/users.py index 43dee3bec2..5dd5ec8d58 100644 --- a/reddwarf/tests/api/users.py +++ b/reddwarf/tests/api/users.py @@ -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 diff --git a/reddwarf/tests/util/__init__.py b/reddwarf/tests/util/__init__.py index a43582b1a8..fd74235916 100644 --- a/reddwarf/tests/util/__init__.py +++ b/reddwarf/tests/util/__init__.py @@ -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]) diff --git a/run_tests.py b/run_tests.py index 7e7fdbe7e6..df33be8c3b 100644 --- a/run_tests.py +++ b/run_tests.py @@ -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 diff --git a/tox.ini b/tox.ini index c81ec16371..5d81c41a07 100644 --- a/tox.ini +++ b/tox.ini @@ -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