diff options
author | spisarski <s.pisarski@cablelabs.com> | 2017-03-22 15:56:54 -0600 |
---|---|---|
committer | spisarski <s.pisarski@cablelabs.com> | 2017-04-12 14:49:56 -0600 |
commit | f340c1e7b021fa3a67c295bcec7f09cddfb687cc (patch) | |
tree | 943ff05f36a4377174a4cf244655271f3e468b3f | |
parent | 4762240029f3ab7393a353f094a746ebbb70f288 (diff) |
Refactored SNAPS tests to take in the actual OSCreds object.
The code previously had individual parameters for different
aspects of the credentials. This change not only makes the
method calls easier, but it also helps the logs from becoming
too verbose as each test case was instantiating its own OSCreds
instance.
JIRA: SNAPS-23
Change-Id: I8860e7329b9ec59d78e5977af74f4d3073496f24
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
-rw-r--r-- | snaps/openstack/tests/os_source_file_test.py | 61 | ||||
-rw-r--r-- | snaps/test_runner.py | 19 | ||||
-rw-r--r-- | snaps/test_suite_builder.py | 226 |
3 files changed, 146 insertions, 160 deletions
diff --git a/snaps/openstack/tests/os_source_file_test.py b/snaps/openstack/tests/os_source_file_test.py index bd37eef..0c9f1b1 100644 --- a/snaps/openstack/tests/os_source_file_test.py +++ b/snaps/openstack/tests/os_source_file_test.py @@ -32,17 +32,23 @@ dev_os_env_file = 'openstack/tests/conf/os_env.yaml' class OSComponentTestCase(unittest.TestCase): - """ - Super for test classes requiring a connection to OpenStack - """ - def __init__(self, method_name='runTest', os_env_file=None, ext_net_name=None, http_proxy_str=None, - ssh_proxy_cmd=None, log_level=logging.DEBUG): + def __init__(self, method_name='runTest', os_creds=None, ext_net_name=None, log_level=logging.DEBUG): + """ + Super for test classes requiring a connection to OpenStack + :param method_name: default 'runTest' + :param os_creds: the OSCreds object, when null it searches for the file {cwd}/openstack/tests/conf/os_env.yaml + :param ext_net_name: the name of the external network that is used for creating routers for floating IPs + :param log_level: the logging level of your test run (default DEBUG) + """ super(OSComponentTestCase, self).__init__(method_name) logging.basicConfig(level=log_level) - self.os_creds = openstack_tests.get_credentials(os_env_file=os_env_file, proxy_settings_str=http_proxy_str, - ssh_proxy_cmd=ssh_proxy_cmd, dev_os_env_file=dev_os_env_file) + if os_creds: + self.os_creds = os_creds + else: + self.os_creds = openstack_tests.get_credentials(dev_os_env_file=dev_os_env_file) + self.ext_net_name = ext_net_name if not self.ext_net_name and file_utils.file_exists(dev_os_env_file): @@ -50,8 +56,7 @@ class OSComponentTestCase(unittest.TestCase): self.ext_net_name = test_conf.get('ext_net') @staticmethod - def parameterize(testcase_klass, os_env_file, ext_net_name, http_proxy_str=None, ssh_proxy_cmd=None, - log_level=logging.DEBUG): + def parameterize(testcase_klass, os_creds, ext_net_name, log_level=logging.DEBUG): """ Create a suite containing all tests taken from the given subclass, passing them the parameter 'param'. """ @@ -59,38 +64,44 @@ class OSComponentTestCase(unittest.TestCase): test_names = test_loader.getTestCaseNames(testcase_klass) suite = unittest.TestSuite() for name in test_names: - suite.addTest(testcase_klass(name, os_env_file, ext_net_name, http_proxy_str, ssh_proxy_cmd, log_level)) + suite.addTest(testcase_klass(name, os_creds, ext_net_name, log_level)) return suite class OSIntegrationTestCase(OSComponentTestCase): - """ - Super for test classes requiring a connection to OpenStack - """ - def __init__(self, method_name='runTest', os_env_file=None, ext_net_name=None, http_proxy_str=None, - ssh_proxy_cmd=None, use_keystone=False, flavor_metadata=None, image_metadata=None, - log_level=logging.DEBUG): - super(OSIntegrationTestCase, self).__init__(method_name=method_name, os_env_file=os_env_file, - ext_net_name=ext_net_name, http_proxy_str=http_proxy_str, - ssh_proxy_cmd=ssh_proxy_cmd, log_level=log_level) + def __init__(self, method_name='runTest', os_creds=None, ext_net_name=None, use_keystone=False, + flavor_metadata=None, image_metadata=None, log_level=logging.DEBUG): + """ + Super for integration tests requiring a connection to OpenStack + :param method_name: default 'runTest' + :param os_creds: the OSCreds object, when null it searches for the file {cwd}/openstack/tests/conf/os_env.yaml + :param ext_net_name: the name of the external network that is used for creating routers for floating IPs + :param use_keystone: when true, these tests will create a new user/project under which to run the test + :param flavor_metadata: dict() to be sent directly into the Nova client generally used for page sizes + :param image_metadata: dict() to be sent directly into the Nova client generally used for multi-part images + :param log_level: the logging level of your test run (default DEBUG) + """ + super(OSIntegrationTestCase, self).__init__(method_name=method_name, os_creds=os_creds, + ext_net_name=ext_net_name, log_level=log_level) self.use_keystone = use_keystone self.keystone = None self.flavor_metadata = flavor_metadata self.image_metadata = image_metadata @staticmethod - def parameterize(testcase_klass, os_env_file, ext_net_name, http_proxy_str=None, ssh_proxy_cmd=None, - use_keystone=False, flavor_metadata=None, image_metadata=None, log_level=logging.DEBUG): - """ Create a suite containing all tests taken from the given - subclass, passing them the parameter 'param'. + def parameterize(testcase_klass, os_creds, ext_net_name, use_keystone=False, flavor_metadata=None, + image_metadata=None, log_level=logging.DEBUG): + """ + Create a suite containing all tests taken from the given + subclass, passing them the parameter 'param'. """ test_loader = unittest.TestLoader() test_names = test_loader.getTestCaseNames(testcase_klass) suite = unittest.TestSuite() for name in test_names: - suite.addTest(testcase_klass(name, os_env_file, ext_net_name, http_proxy_str, ssh_proxy_cmd, use_keystone, - flavor_metadata, image_metadata, log_level)) + suite.addTest(testcase_klass(name, os_creds, ext_net_name, use_keystone, flavor_metadata, image_metadata, + log_level)) return suite """ diff --git a/snaps/test_runner.py b/snaps/test_runner.py index a8f2313..00b1b25 100644 --- a/snaps/test_runner.py +++ b/snaps/test_runner.py @@ -19,6 +19,7 @@ import os import unittest from snaps import test_suite_builder +from snaps.openstack.tests import openstack_tests __author__ = 'spisarski' @@ -51,26 +52,28 @@ def __create_test_suite(source_filename, ext_net_name, proxy_settings, ssh_proxy """ suite = unittest.TestSuite() + os_creds = openstack_tests.get_credentials(os_env_file=source_filename, proxy_settings_str=proxy_settings, + ssh_proxy_cmd=ssh_proxy_cmd) + # Tests that do not require a remote connection to an OpenStack cloud if run_unit_tests: test_suite_builder.add_unit_tests(suite) # Basic connection tests if run_connection_tests: - test_suite_builder.add_openstack_client_tests(suite, source_filename, ext_net_name, use_keystone=use_keystone, - http_proxy_str=proxy_settings, log_level=log_level) + test_suite_builder.add_openstack_client_tests( + suite=suite, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, log_level=log_level) # Tests the OpenStack API calls if run_api_tests: - test_suite_builder.add_openstack_api_tests(suite, source_filename, ext_net_name, use_keystone=use_keystone, - http_proxy_str=proxy_settings, log_level=log_level) + test_suite_builder.add_openstack_api_tests( + suite=suite, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, log_level=log_level) # Long running integration type tests if run_integration_tests: - test_suite_builder.add_openstack_integration_tests(suite, source_filename, ext_net_name, use_keystone=use_keystone, - proxy_settings=proxy_settings, ssh_proxy_cmd=ssh_proxy_cmd, - flavor_metadata=flavor_metadata, - use_floating_ips=use_floating_ips, log_level=log_level) + test_suite_builder.add_openstack_integration_tests( + suite=suite, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, use_floating_ips=use_floating_ips, log_level=log_level) return suite diff --git a/snaps/test_suite_builder.py b/snaps/test_suite_builder.py index bf4bcdb..77f6ed6 100644 --- a/snaps/test_suite_builder.py +++ b/snaps/test_suite_builder.py @@ -64,41 +64,37 @@ def add_unit_tests(suite): suite.addTest(unittest.TestLoader().loadTestsFromTestCase(VmInstanceSettingsUnitTests)) -def add_openstack_client_tests(suite, source_filename, ext_net_name, use_keystone=True, http_proxy_str=None, - log_level=logging.INFO): +def add_openstack_client_tests(suite, os_creds, ext_net_name, use_keystone=True, log_level=logging.INFO): """ Adds tests written to exercise OpenStack client retrieval :param suite: the unittest.TestSuite object to which to add the tests - :param source_filename: the OpenStack credentials filename + :param os_creds: and instance of OSCreds that holds the credentials required by OpenStack :param ext_net_name: the name of an external network on the cloud under test - :param http_proxy_str: <host>:<port> of the proxy server (optional) :param use_keystone: when True, tests requiring direct access to Keystone are added as these need to be running on a host that has access to the cloud's private network :param log_level: the logging level :return: None as the tests will be adding to the 'suite' parameter object """ # Basic connection tests - suite.addTest(OSComponentTestCase.parameterize(GlanceSmokeTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize(GlanceSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) if use_keystone: - suite.addTest(OSComponentTestCase.parameterize(KeystoneSmokeTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize(KeystoneSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(NeutronSmokeTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(NovaSmokeTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize(NeutronSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize(NovaSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, + log_level=log_level)) -def add_openstack_api_tests(suite, source_filename, ext_net_name, http_proxy_str=None, use_keystone=True, - log_level=logging.INFO): +def add_openstack_api_tests(suite, os_creds, ext_net_name, use_keystone=True, log_level=logging.INFO): """ Adds tests written to exercise all existing OpenStack APIs :param suite: the unittest.TestSuite object to which to add the tests - :param source_filename: the OpenStack credentials filename + :param os_creds: and instance of OSCreds that holds the credentials required by OpenStack :param ext_net_name: the name of an external network on the cloud under test - :param http_proxy_str: <host>:<port> of the proxy server (optional) :param use_keystone: when True, tests requiring direct access to Keystone are added as these need to be running on a host that has access to the cloud's private network :param log_level: the logging level @@ -106,44 +102,41 @@ def add_openstack_api_tests(suite, source_filename, ext_net_name, http_proxy_str """ # Tests the OpenStack API calls if use_keystone: - suite.addTest(OSComponentTestCase.parameterize(KeystoneUtilsTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(CreateUserSuccessTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(CreateProjectSuccessTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(CreateProjectUserTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - - suite.addTest(OSComponentTestCase.parameterize(GlanceUtilsTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(NeutronUtilsNetworkTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(NeutronUtilsSubnetTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(NeutronUtilsRouterTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(NeutronUtilsSecurityGroupTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(NovaUtilsKeypairTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(NovaUtilsFlavorTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize(CreateFlavorTests, source_filename, ext_net_name, - http_proxy_str=http_proxy_str, log_level=log_level)) - - -def add_openstack_integration_tests(suite, source_filename, ext_net_name, proxy_settings=None, ssh_proxy_cmd=None, - use_keystone=True, flavor_metadata=None, image_metadata=None, - use_floating_ips=True, log_level=logging.INFO): + suite.addTest(OSComponentTestCase.parameterize( + KeystoneUtilsTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + CreateUserSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + CreateProjectSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + CreateProjectUserTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + + suite.addTest(OSComponentTestCase.parameterize( + GlanceUtilsTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsNetworkTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsSubnetTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsRouterTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NeutronUtilsSecurityGroupTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NovaUtilsKeypairTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + NovaUtilsFlavorTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + CreateFlavorTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) + + +def add_openstack_integration_tests(suite, os_creds, ext_net_name, use_keystone=True, flavor_metadata=None, + image_metadata=None, use_floating_ips=True, log_level=logging.INFO): """ Adds tests written to exercise all long-running OpenStack integration tests meaning they will be creating VM instances and potentially performing some SSH functions through floating IPs :param suite: the unittest.TestSuite object to which to add the tests - :param source_filename: the OpenStack credentials filename + :param os_creds: and instance of OSCreds that holds the credentials required by OpenStack :param ext_net_name: the name of an external network on the cloud under test - :param proxy_settings: <host>:<port> of the proxy server (optional) - :param ssh_proxy_cmd: the command your environment requires for creating ssh connections through a proxy :param use_keystone: when True, tests requiring direct access to Keystone are added as these need to be running on a host that has access to the cloud's private network :param image_metadata: dict() object containing metadata for creating an image with custom config: @@ -159,92 +152,71 @@ def add_openstack_integration_tests(suite, source_filename, ext_net_name, proxy_ # and project # Creator Object tests - suite.addTest(OSIntegrationTestCase.parameterize(CreateSecurityGroupTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateImageSuccessTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateImageNegativeTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateMultiPartImageTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateKeypairsTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateNetworkSuccessTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateRouterSuccessTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateRouterNegativeTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateSecurityGroupTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateImageSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateImageNegativeTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateMultiPartImageTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateKeypairsTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateNetworkSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateRouterSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateRouterNegativeTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) # VM Instances - suite.addTest(OSIntegrationTestCase.parameterize(SimpleHealthCheck, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateInstanceSimpleTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateInstancePortManipulationTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(InstanceSecurityGroupTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateInstanceOnComputeHost, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateInstanceFromThreePartImage, source_filename, ext_net_name, - http_proxy_str=proxy_settings, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + SimpleHealthCheck, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceSimpleTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstancePortManipulationTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + InstanceSecurityGroupTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceOnComputeHost, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceFromThreePartImage, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) if use_floating_ips: - suite.addTest(OSIntegrationTestCase.parameterize(CreateInstanceSingleNetworkTests, source_filename, - ext_net_name, http_proxy_str=proxy_settings, - ssh_proxy_cmd=ssh_proxy_cmd, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(CreateInstancePubPrivNetTests, source_filename, - ext_net_name, http_proxy_str=proxy_settings, - ssh_proxy_cmd=ssh_proxy_cmd, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize(AnsibleProvisioningTests, source_filename, - ext_net_name, http_proxy_str=proxy_settings, - ssh_proxy_cmd=ssh_proxy_cmd, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - - -def add_openstack_staging_tests(suite, source_filename, ext_net_name, proxy_settings=None, log_level=logging.INFO): + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstanceSingleNetworkTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + CreateInstancePubPrivNetTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + suite.addTest(OSIntegrationTestCase.parameterize( + AnsibleProvisioningTests, os_creds=os_creds, ext_net_name=ext_net_name, use_keystone=use_keystone, + flavor_metadata=flavor_metadata, image_metadata=image_metadata, log_level=log_level)) + + +def add_openstack_staging_tests(suite, os_creds, ext_net_name, log_level=logging.INFO): """ Adds tests that are still in development have not been designed to run successfully against all OpenStack pods :param suite: the unittest.TestSuite object to which to add the tests - :param source_filename: the OpenStack credentials filename + :param os_creds: and instance of OSCreds that holds the credentials required by OpenStack :param ext_net_name: the name of an external network on the cloud under test - :param proxy_settings: <host>:<port> of the proxy server (optional) :param log_level: the logging level :return: None as the tests will be adding to the 'suite' parameter object """ - suite.addTest(OSComponentTestCase.parameterize(CreateNetworkTypeTests, source_filename, ext_net_name, - http_proxy_str=proxy_settings, log_level=log_level)) + suite.addTest(OSComponentTestCase.parameterize( + CreateNetworkTypeTests, os_creds=os_creds, ext_net_name=ext_net_name, log_level=log_level)) |