diff options
Diffstat (limited to 'functest/opnfv_tests/openstack/tempest')
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/conf_utils.py | 15 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 46 |
2 files changed, 15 insertions, 46 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 2cdc2cf64..4202df625 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -119,18 +119,21 @@ def backup_tempest_config(conf_file): """ Copy config file to tempest results directory """ + if not os.path.exists(TEMPEST_RESULTS_DIR): + os.makedirs(TEMPEST_RESULTS_DIR) shutil.copyfile(conf_file, os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf')) def configure_tempest(deployment_dir, image_id=None, flavor_id=None, - mode=None): + compute_cnt=None): """ Calls rally verify and updates the generated tempest.conf with given parameters """ conf_file = configure_verifier(deployment_dir) - configure_tempest_update_params(conf_file, image_id, flavor_id) + configure_tempest_update_params(conf_file, image_id, flavor_id, + compute_cnt) def configure_tempest_defcore(deployment_dir, image_id, flavor_id, @@ -186,8 +189,8 @@ def generate_test_accounts_file(tenant_id): yaml.dump(accounts_list, f, default_flow_style=False) -def configure_tempest_update_params(tempest_conf_file, - image_id=None, flavor_id=None): +def configure_tempest_update_params(tempest_conf_file, image_id=None, + flavor_id=None, compute_cnt=1): """ Add/update needed parameters into tempest.conf file """ @@ -210,6 +213,10 @@ def configure_tempest_update_params(tempest_conf_file, config.set('compute', 'flavor_ref', flavor_id) if FLAVOR_ID_ALT is not None: config.set('compute', 'flavor_ref_alt', FLAVOR_ID_ALT) + if compute_cnt > 1: + # enable multinode tests + config.set('compute', 'min_compute_nodes', compute_cnt) + config.set('identity', 'region', 'RegionOne') if os_utils.is_keystone_v3(): auth_version = 'v3' diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index b8a4e9adc..19200142d 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -20,10 +20,10 @@ import time import yaml from functest.core import testcase +from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.opnfv_tests.openstack.tempest import conf_utils from functest.utils.constants import CONST import functest.utils.functest_utils as ft_utils -import functest.utils.openstack_utils as os_utils from snaps.openstack import create_flavor from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor @@ -234,11 +234,13 @@ class TempestCommon(testcase.TestCase): if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) resources = self.resources.create() + compute_cnt = snaps_utils.get_active_compute_cnt( + self.resources.os_creds) conf_utils.configure_tempest( self.DEPLOYMENT_DIR, image_id=resources.get("image_id"), flavor_id=resources.get("flavor_id"), - mode=self.MODE) + compute_cnt=compute_cnt) self.generate_test_list(self.VERIFIER_REPO_DIR) self.apply_tempest_blacklist() self.run_verifier_tests() @@ -253,46 +255,6 @@ class TempestCommon(testcase.TestCase): self.stop_time = time.time() return res - def create_snapshot(self): - """ - Run the Tempest cleanup utility to initialize OS state. - - :return: TestCase.EX_OK - """ - logger.info("Initializing the saved state of the OpenStack deployment") - - if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): - os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) - - # Make sure that the verifier is configured - conf_utils.configure_verifier(self.DEPLOYMENT_DIR) - - try: - os_utils.init_tempest_cleanup( - self.DEPLOYMENT_DIR, 'tempest.conf', - os.path.join(conf_utils.TEMPEST_RESULTS_DIR, - "tempest-cleanup-init.log")) - except Exception as err: - logger.error(str(err)) - return testcase.TestCase.EX_RUN_ERROR - - return super(TempestCommon, self).create_snapshot() - - def clean(self): - """ - Run the Tempest cleanup utility to delete and destroy OS resources - created by Tempest. - """ - logger.info("Destroying the resources created for refstack") - - os_utils.perform_tempest_cleanup( - self.DEPLOYMENT_DIR, 'tempest.conf', - os.path.join(conf_utils.TEMPEST_RESULTS_DIR, - "tempest-cleanup.log") - ) - - return super(TempestCommon, self).clean() - class TempestSmokeSerial(TempestCommon): |