summaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/tempest/tempest.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-09-05 15:17:04 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-09-08 09:47:21 +0200
commit6a8a15f5bd5ec8ef2163d9b25e6c1c935eca42aa (patch)
treec1d2e34da411df73ce0e4705a2054d976434be0f /functest/opnfv_tests/openstack/tempest/tempest.py
parent2c4a269e22d1727ba15fe9a4a946485b7321d292 (diff)
Update scenario section in tempest.conf
It's required at least by Barbican tempest plugin. Change-Id: I46a65ee5fee044917c5375adaa8ebb529efe86ec Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 9ec639526ed32d4b05168627c5c016fb66b7d008)
Diffstat (limited to 'functest/opnfv_tests/openstack/tempest/tempest.py')
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index 9b4a48287..6692a6e10 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -299,6 +299,29 @@ class TempestCommon(singlevm.VmReady2):
with open(rally_conf, 'wb') as config_file:
rconfig.write(config_file)
+ def update_scenario_section(self):
+ """Update scenario section in tempest.conf"""
+ rconfig = configparser.RawConfigParser()
+ rconfig.read(self.conf_file)
+ filename = getattr(
+ config.CONF, '{}_image'.format(self.case_name), self.filename)
+ if not rconfig.has_section('scenario'):
+ rconfig.add_section('scenario')
+ rconfig.set('scenario', 'img_file', os.path.basename(filename))
+ rconfig.set('scenario', 'img_dir', os.path.dirname(filename))
+ rconfig.set('scenario', 'img_disk_format', getattr(
+ config.CONF, '{}_image_format'.format(self.case_name),
+ self.image_format))
+ extra_properties = self.extra_properties.copy()
+ extra_properties.update(
+ getattr(config.CONF, '{}_extra_properties'.format(
+ self.case_name), {}))
+ rconfig.set(
+ 'scenario', 'img_properties',
+ conf_utils.convert_dict_to_ini(extra_properties))
+ with open(self.conf_file, 'wb') as config_file:
+ rconfig.write(config_file)
+
def configure(self, **kwargs): # pylint: disable=unused-argument
"""
Create all openstack resources for tempest-based testcases and write
@@ -321,6 +344,7 @@ class TempestCommon(singlevm.VmReady2):
image_alt_id=self.image_alt.id,
flavor_alt_id=self.flavor_alt.id,
domain_name=self.cloud.auth.get("project_domain_name", "Default"))
+ self.update_scenario_section()
self.backup_tempest_config(self.conf_file, self.res_dir)
def run(self, **kwargs):