From fa0a614c8ea3e757440c82380707e0221079e32a Mon Sep 17 00:00:00 2001 From: Linda Wang Date: Mon, 4 Dec 2017 06:36:06 +0000 Subject: Fix the yamllint errors in functest/ci And also, remove the params "tempest_use_custom_images" and "unique_names" of vping, rally and tempest. Change-Id: Ic4243ef2f5e965910e5befa87db8d585cad34fa2 Signed-off-by: Linda Wang --- functest/opnfv_tests/openstack/rally/rally.py | 4 +-- .../openstack/snaps/snaps_test_runner.py | 6 ++-- .../opnfv_tests/openstack/tempest/conf_utils.py | 10 +++---- functest/opnfv_tests/openstack/tempest/tempest.py | 34 ++++++++++------------ functest/opnfv_tests/openstack/vping/vping_base.py | 6 ++-- 5 files changed, 27 insertions(+), 33 deletions(-) (limited to 'functest/opnfv_tests/openstack') diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 0c657688e..a808d0360 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -99,9 +99,7 @@ class RallyBase(testcase.TestCase): os_env_file=CONST.__getattribute__('openstack_creds'), overrides=creds_override) - self.guid = '' - if CONST.__getattribute__('rally_unique_names'): - self.guid = '-' + str(uuid.uuid4()) + self.guid = '-' + str(uuid.uuid4()) self.creators = [] self.mode = '' diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index bfdcd8626..023f1bbd0 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -41,8 +41,10 @@ class SnapsTestRunner(unit.Suite): else: self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds) - self.use_fip = CONST.__getattribute__('snaps_use_floating_ips') - self.use_keystone = CONST.__getattribute__('snaps_use_keystone') + self.use_fip = ( + CONST.__getattribute__('snaps_use_floating_ips') == 'True') + self.use_keystone = ( + CONST.__getattribute__('snaps_use_keystone') == 'True') scenario = CONST.__getattribute__('DEPLOY_SCENARIO') self.flavor_metadata = None diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index b4026def3..fff99a320 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -257,11 +257,11 @@ def configure_tempest_update_params(tempest_conf_file, image_id=None, CONST.__getattribute__('tempest_private_net_name')) config.set('compute', 'volume_device_name', CONST.__getattribute__('tempest_volume_device_name')) - if CONST.__getattribute__('tempest_use_custom_images'): - if image_id is not None: - config.set('compute', 'image_ref', image_id) - if IMAGE_ID_ALT is not None: - config.set('compute', 'image_ref_alt', IMAGE_ID_ALT) + + if image_id is not None: + config.set('compute', 'image_ref', image_id) + if IMAGE_ID_ALT is not None: + config.set('compute', 'image_ref_alt', IMAGE_ID_ALT) if CONST.__getattribute__('tempest_use_custom_flavors'): if flavor_id is not None: config.set('compute', 'flavor_ref', flavor_id) diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index bede02fbb..979e992f2 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -318,9 +318,7 @@ class TempestResourcesManager(object): self.os_creds = openstack_tests.get_credentials( os_env_file=CONST.__getattribute__('openstack_creds')) - self.guid = '' - if CONST.__getattribute__('tempest_unique_names'): - self.guid = '-' + str(uuid.uuid4()) + self.guid = '-' + str(uuid.uuid4()) self.creators = list() @@ -384,21 +382,19 @@ class TempestResourcesManager(object): flavor_id = None flavor_id_alt = None - if (CONST.__getattribute__('tempest_use_custom_images') or - use_custom_images): - logger.debug("Creating image for Tempest suite") - image_base_name = CONST.__getattribute__( - 'openstack_image_name') + self.guid - os_image_settings = openstack_tests.cirros_image_settings( - image_base_name, public=True, - image_metadata=self.cirros_image_config) - logger.debug("Creating image for Tempest suite") - image_creator = deploy_utils.create_image( - self.os_creds, os_image_settings) - if image_creator is None: - raise Exception('Failed to create image') - self.creators.append(image_creator) - image_id = image_creator.get_image().id + logger.debug("Creating image for Tempest suite") + image_base_name = CONST.__getattribute__( + 'openstack_image_name') + self.guid + os_image_settings = openstack_tests.cirros_image_settings( + image_base_name, public=True, + image_metadata=self.cirros_image_config) + logger.debug("Creating image for Tempest suite") + image_creator = deploy_utils.create_image( + self.os_creds, os_image_settings) + if image_creator is None: + raise Exception('Failed to create image') + self.creators.append(image_creator) + image_id = image_creator.get_image().id if use_custom_images: logger.debug("Creating 2nd image for Tempest suite") @@ -415,7 +411,7 @@ class TempestResourcesManager(object): self.creators.append(image_creator_alt) image_id_alt = image_creator_alt.get_image().id - if (CONST.__getattribute__('tempest_use_custom_flavors') or + if (CONST.__getattribute__('tempest_use_custom_flavors') == 'True' or use_custom_flavors): logger.info("Creating flavor for Tempest suite") scenario = CONST.__getattribute__('DEPLOY_SCENARIO') diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 318e9c45f..f3d4d50f5 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -60,9 +60,7 @@ class VPingBase(testcase.TestCase): self.router_creator = None # Shared metadata - self.guid = '' - if CONST.__getattribute__('vping_unique_names'): - self.guid = '-' + str(uuid.uuid4()) + self.guid = '-' + str(uuid.uuid4()) self.router_name = CONST.__getattribute__( 'vping_router_name') + self.guid @@ -197,7 +195,7 @@ class VPingBase(testcase.TestCase): Cleanup all OpenStack objects. Should be called on completion :return: """ - if CONST.__getattribute__('vping_cleanup_objects'): + if CONST.__getattribute__('vping_cleanup_objects') == 'True': for creator in reversed(self.creators): try: creator.clean() -- cgit 1.2.3-korg