diff options
author | 2019-01-19 19:38:12 +0000 | |
---|---|---|
committer | 2019-01-19 19:38:12 +0000 | |
commit | ad93c57678ccd0719e43fbbadc108b00a71f6038 (patch) | |
tree | 69f47a117a50018f462efabbc53e6a68605e6f22 | |
parent | c39b5e0bb26c1d80f7785d3139b4109c218913a4 (diff) | |
parent | b482b494ce695e83cca0a10e7750200fd1be42ea (diff) |
Merge "Move logics out of TempestCommon.__init__()"
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 55 | ||||
-rw-r--r-- | functest/tests/unit/openstack/tempest/test_tempest.py | 1 |
2 files changed, 34 insertions, 22 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 4fd466780..9d788de8c 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -59,28 +59,10 @@ class TempestCommon(singlevm.VmReady2): self.orig_cloud.grant_role( self.role_name, user=self.project.user.id, domain=self.project.domain.id) - environ = dict( - os.environ, - OS_USERNAME=self.project.user.name, - OS_PROJECT_NAME=self.project.project.name, - OS_PROJECT_ID=self.project.project.id, - OS_PASSWORD=self.project.password) - try: - del environ['OS_TENANT_NAME'] - del environ['OS_TENANT_ID'] - except Exception: # pylint: disable=broad-except - pass - self.deployment_id = conf_utils.create_rally_deployment( - environ=environ) - if not self.deployment_id: - raise Exception("Deployment create failed") - self.verifier_id = conf_utils.create_verifier() - if not self.verifier_id: - raise Exception("Verifier create failed") - self.verifier_repo_dir = conf_utils.get_verifier_repo_dir( - self.verifier_id) - self.deployment_dir = conf_utils.get_verifier_deployment_dir( - self.verifier_id, self.deployment_id) + self.deployment_id = None + self.verifier_id = None + self.verifier_repo_dir = None + self.deployment_dir = None self.verification_id = None self.res_dir = os.path.join( getattr(config.CONF, 'dir_results'), self.case_name) @@ -347,6 +329,8 @@ class TempestCommon(singlevm.VmReady2): os.makedirs(self.res_dir) rconfig = configparser.RawConfigParser() rconfig.read(rally_conf) + rconfig.set('DEFAULT', 'debug', True) + rconfig.set('DEFAULT', 'use_stderr', False) rconfig.set('DEFAULT', 'log-file', 'rally.log') rconfig.set('DEFAULT', 'log_dir', self.res_dir) with open(rally_conf, 'wb') as config_file: @@ -361,6 +345,10 @@ class TempestCommon(singlevm.VmReady2): rconfig.remove_option('openstack', 'img_name_regex') if rconfig.has_option('openstack', 'swift_operator_role'): rconfig.remove_option('openstack', 'swift_operator_role') + if rconfig.has_option('DEFAULT', 'use_stderr'): + rconfig.remove_option('DEFAULT', 'use_stderr') + if rconfig.has_option('DEFAULT', 'debug'): + rconfig.remove_option('DEFAULT', 'debug') if rconfig.has_option('DEFAULT', 'log-file'): rconfig.remove_option('DEFAULT', 'log-file') if rconfig.has_option('DEFAULT', 'log_dir'): @@ -402,6 +390,29 @@ class TempestCommon(singlevm.VmReady2): """ if not os.path.exists(self.res_dir): os.makedirs(self.res_dir) + environ = dict( + os.environ, + OS_USERNAME=self.project.user.name, + OS_PROJECT_NAME=self.project.project.name, + OS_PROJECT_ID=self.project.project.id, + OS_PASSWORD=self.project.password) + try: + del environ['OS_TENANT_NAME'] + del environ['OS_TENANT_ID'] + except Exception: # pylint: disable=broad-except + pass + self.deployment_id = conf_utils.create_rally_deployment( + environ=environ) + if not self.deployment_id: + raise Exception("Deployment create failed") + self.verifier_id = conf_utils.create_verifier() + if not self.verifier_id: + raise Exception("Verifier create failed") + self.verifier_repo_dir = conf_utils.get_verifier_repo_dir( + self.verifier_id) + self.deployment_dir = conf_utils.get_verifier_deployment_dir( + self.verifier_id, self.deployment_id) + compute_cnt = len(self.orig_cloud.list_hypervisors()) self.image_alt = self.publish_image_alt() diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py index 67e7dd431..c1f245c72 100644 --- a/functest/tests/unit/openstack/tempest/test_tempest.py +++ b/functest/tests/unit/openstack/tempest/test_tempest.py @@ -82,6 +82,7 @@ class OSTempestTesting(unittest.TestCase): else: testr_mode = self.tempestcommon.mode verifier_repo_dir = 'test_verifier_repo_dir' + self.tempestcommon.verifier_repo_dir = verifier_repo_dir cmd = "(cd {0}; stestr list '{1}' >{2} 2>/dev/null)".format( verifier_repo_dir, testr_mode, self.tempestcommon.list) self.tempestcommon.generate_test_list(mode=testr_mode) |