From a11fa0a172000d106b6168b3a0ecde3bc1e82163 Mon Sep 17 00:00:00 2001 From: meimei Date: Thu, 14 Jul 2016 12:04:37 +0800 Subject: [multisite] integrate kingbird tempest testcases JIRA: FUNCTEST-179 Change-Id: I4a8ae43e2814b3d859c32a6278671f87155aa855 Signed-off-by: meimei --- testcases/OpenStack/tempest/run_tempest.py | 44 +++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'testcases') diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py index a16ba26f7..ab79a8768 100755 --- a/testcases/OpenStack/tempest/run_tempest.py +++ b/testcases/OpenStack/tempest/run_tempest.py @@ -33,7 +33,7 @@ import functest.utils.openstack_utils as os_utils modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing', 'identity', 'image', 'network', 'object_storage', 'orchestration', - 'telemetry', 'volume', 'custom', 'defcore'] + 'telemetry', 'volume', 'custom', 'defcore', 'feature_multisite'] """ tests configuration """ parser = argparse.ArgumentParser() @@ -211,6 +211,45 @@ def configure_tempest(deployment_dir): return True +def configure_tempest_feature(deployment_dir, mode): + """ + Add/update needed parameters into tempest.conf file generated by Rally + """ + + logger.debug("Finding tempest.conf file...") + tempest_conf_file = deployment_dir + "/tempest.conf" + if not os.path.isfile(tempest_conf_file): + logger.error("Tempest configuration file %s NOT found." + % tempest_conf_file) + exit(-1) + + logger.debug("Updating selected tempest.conf parameters...") + config = ConfigParser.RawConfigParser() + config.read(tempest_conf_file) + if mode == 'feature_multisite': + config.set('service_available', 'kingbird', 'true') + cmd = "openstack endpoint show kingbird | grep publicurl |\ + awk '{print $4}' | awk -F '/' '{print $3}'" + kingbird_endpoint_url = os.popen(cmd).read() + cmd = "openstack endpoint show kingbird | grep publicurl |\ + awk '{print $4}' | awk -F '/' '{print $4}'" + kingbird_api_version = os.popen(cmd).read() + try: + config.add_section("kingbird") + except: + logger.info('kingbird section exist') + config.set('kingbird', 'endpoint_type', 'publicURL') + config.set('kingbird', 'TIME_TO_SYNC', '20') + config.set('kingbird', 'endpoint_url', kingbird_endpoint_url) + config.set('kingbird', 'api_version', kingbird_api_version) + with open(tempest_conf_file, 'wb') as config_file: + config.write(config_file) + + # Copy tempest.conf to /home/opnfv/functest/results/tempest/ + shutil.copyfile(tempest_conf_file, TEMPEST_RESULTS_DIR + '/tempest.conf') + return True + + def read_file(filename): with open(filename) as src: return [line.strip() for line in src.readlines()] @@ -230,6 +269,8 @@ def generate_test_list(deployment_dir, mode): else: if mode == 'smoke': testr_mode = "smoke" + elif mode == 'feature_multisite': + testr_mode = " | grep kingbird " elif mode == 'full': testr_mode = "" else: @@ -365,6 +406,7 @@ def main(): deployment_dir = ft_utils.get_deployment_dir(logger) configure_tempest(deployment_dir) + configure_tempest_feature(deployment_dir, args.mode) create_tempest_resources() generate_test_list(deployment_dir, args.mode) apply_tempest_blacklist() -- cgit 1.2.3-korg