From ef0431498920058768361cf908aa79d8e645ef4b Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Thu, 2 Apr 2020 18:37:30 +0200 Subject: Add tempest_heat (heat-tempest-plugin) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It asks for the Fedora-Cloud-Base image and a second user account. It should be noted that heat-tempest-plugin duplicates all configs from tempest. Minimal image is still Cirros and the first account is the admin one. Then it conforms with the TempestCommon logic. AodhAlarmTest is skipped by default because pre conditions are missing. SoftwareConfigIntegrationTest is skipped as in gates because it requires a custom image [1] [1] https://github.com/openstack/heat/blob/master/devstack/lib/heat#L444 Change-Id: I8b39dc65ef3714411cd828e17b95e124f2e90f34 Signed-off-by: Cédric Ollivier --- .../tempest/custom_tests/tempest_conf.yaml | 5 ++ .../tempest/custom_tests/tempest_conf_ovn.yaml | 5 ++ functest/opnfv_tests/openstack/tempest/tempest.py | 66 ++++++++++++++++++++++ 3 files changed, 76 insertions(+) (limited to 'functest/opnfv_tests') diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml index f5b9e38d1..b4321dbdf 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml @@ -81,3 +81,8 @@ object-storage-feature-enabled: tempurl,crossdomain,container_quotas,staticweb,account_quotas,slo" object_versioning: true discoverability: true +heat_plugin: + skip_scenario_test_list: AodhAlarmTest,SoftwareConfigIntegrationTest + auth_version: 3 +heat_features_enabled: + multi_cloud: false diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml index 9d2c7015f..d5daedf4d 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml @@ -81,3 +81,8 @@ object-storage-feature-enabled: tempurl,crossdomain,container_quotas,staticweb,account_quotas,slo" object_versioning: true discoverability: true +heat_plugin: + skip_scenario_test_list: AodhAlarmTest,SoftwareConfigIntegrationTest + auth_version: 3 +heat_features_enabled: + multi_cloud: false diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 0bb1e6e0f..14fa9f1c7 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -669,3 +669,69 @@ class TempestHorizon(TempestCommon): with open(self.conf_file, 'w') as config_file: rconfig.write(config_file) self.backup_tempest_config(self.conf_file, self.res_dir) + + +class TempestHeat(TempestCommon): + """Tempest Heat testcase implementation class.""" + + filename_alt = ('/home/opnfv/functest/images/' + 'Fedora-Cloud-Base-30-1.2.x86_64.qcow2') + flavor_alt_ram = 512 + flavor_alt_vcpus = 1 + flavor_alt_disk = 4 + + def __init__(self, **kwargs): + super(TempestHeat, self).__init__(**kwargs) + self.user2 = self.orig_cloud.create_user( + name='{}-user2_{}'.format(self.case_name, self.project.guid), + password=self.project.password, + domain_id=self.project.domain.id) + if not self.orig_cloud.get_role("heat_stack_owner"): + self.role = self.orig_cloud.create_role("heat_stack_owner") + self.orig_cloud.grant_role( + "heat_stack_owner", user=self.user2.id, + project=self.project.project.id, + domain=self.project.domain.id) + + def configure(self, **kwargs): + assert self.user2 + super(TempestHeat, self).configure(**kwargs) + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('heat_plugin'): + rconfig.add_section('heat_plugin') + # It fails if region and domain ids are unset + rconfig.set( + 'heat_plugin', 'region', + os.environ.get('OS_REGION_NAME', 'RegionOne')) + rconfig.set('heat_plugin', 'auth_url', os.environ["OS_AUTH_URL"]) + rconfig.set('heat_plugin', 'project_domain_id', self.project.domain.id) + rconfig.set('heat_plugin', 'user_domain_id', self.project.domain.id) + rconfig.set( + 'heat_plugin', 'project_domain_name', self.project.domain.name) + rconfig.set( + 'heat_plugin', 'user_domain_name', self.project.domain.name) + rconfig.set('heat_plugin', 'username', self.user2.name) + rconfig.set('heat_plugin', 'password', self.project.password) + rconfig.set('heat_plugin', 'project_name', self.project.project.name) + rconfig.set('heat_plugin', 'admin_username', self.project.user.name) + rconfig.set('heat_plugin', 'admin_password', self.project.password) + rconfig.set( + 'heat_plugin', 'admin_project_name', self.project.project.name) + rconfig.set('heat_plugin', 'image_ref', self.image_alt.id) + rconfig.set('heat_plugin', 'instance_type', self.flavor_alt.id) + rconfig.set('heat_plugin', 'minimal_image_ref', self.image.id) + rconfig.set('heat_plugin', 'minimal_instance_type', self.flavor.id) + rconfig.set('heat_plugin', 'floating_network_name', self.ext_net.name) + rconfig.set('heat_plugin', 'fixed_network_name', self.network.name) + with open(self.conf_file, 'w') as config_file: + rconfig.write(config_file) + self.backup_tempest_config(self.conf_file, self.res_dir) + + def clean(self): + """ + Cleanup all OpenStack objects. Should be called on completion. + """ + super(TempestHeat, self).clean() + if self.user2: + self.orig_cloud.delete_user(self.user2.id) -- cgit 1.2.3-korg