aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/VIM/OpenStack/CI/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/VIM/OpenStack/CI/libraries')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py49
1 files changed, 31 insertions, 18 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index 75ce7fb9..4ff31176 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -29,7 +29,7 @@ from neutronclient.v2_0 import client as neutronclient
modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing',
'identity', 'image', 'network', 'object_storage', 'orchestration',
- 'telemetry', 'volume', 'custom']
+ 'telemetry', 'volume', 'custom', 'defcore']
""" tests configuration """
parser = argparse.ArgumentParser()
@@ -88,6 +88,9 @@ DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name")
RALLY_INSTALLATION_DIR = functest_yaml.get("general").get("directories").get("dir_rally_inst")
RESULTS_DIR = functest_yaml.get("general").get("directories").get("dir_results")
TEMPEST_RESULTS_DIR = RESULTS_DIR + '/tempest'
+TEST_LIST_DIR = functest_yaml.get("general").get("directories").get("dir_tempest_cases")
+TEMPEST_LIST_FILE = REPO_PATH + TEST_LIST_DIR + 'test_list.txt'
+TEMPEST_DEFCORE = REPO_PATH + TEST_LIST_DIR + 'defcore_req.txt'
def get_info(file_result):
@@ -139,13 +142,13 @@ def create_tempest_resources():
logger.info("Creating tenant and user for Tempest suite")
keystone = ksclient.Client(**ks_creds)
tenant_id = openstack_utils.create_tenant(keystone,
- TENANT_NAME,
- TENANT_DESCRIPTION)
+ TENANT_NAME,
+ TENANT_DESCRIPTION)
if tenant_id == '':
logger.error("Error : Failed to create %s tenant" % TENANT_NAME)
user_id = openstack_utils.create_user(keystone, USER_NAME, USER_PASSWORD,
- None, tenant_id)
+ None, tenant_id)
if user_id == '':
logger.error("Error : Failed to create %s user" % USER_NAME)
@@ -170,7 +173,7 @@ def free_tempest_resources():
logger.error("Error : Failed to delete %s tenant" % TENANT_NAME)
-def configure_tempest():
+def configure_tempest(mode):
"""
Add/update needed parameters into tempest.conf file generated by Rally
"""
@@ -179,7 +182,7 @@ def configure_tempest():
cmd = "rally verify genconfig"
functest_utils.execute_command(cmd, logger)
- logger.debug("Resolving deployment UUID...")
+ logger.debug("Resolving deployment UUID and directory...")
cmd = "rally deployment list | awk '/"+DEPLOYMENT_MAME+"/ {print $2}'"
p = subprocess.Popen(cmd, shell=True,
stdout=subprocess.PIPE,
@@ -188,14 +191,23 @@ def configure_tempest():
if deployment_uuid == "":
logger.debug(" Rally deployment NOT found")
return False
+ deployment_dir = RALLY_INSTALLATION_DIR + "/tempest/for-deployment-" + deployment_uuid
logger.debug("Finding tempest.conf file...")
- tempest_conf_file = RALLY_INSTALLATION_DIR+"/tempest/for-deployment-" \
- + deployment_uuid + "/tempest.conf"
+ 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)
return False
+ logger.debug("Generating test case list...")
+ cmd = "cd " + deployment_dir + ";"
+ if mode == 'smoke':
+ cmd += "testr list-tests smoke >" + TEMPEST_LIST_FILE + ";cd"
+ functest_utils.execute_command(cmd, logger)
+ elif mode == 'full':
+ cmd += "testr list-tests >" + TEMPEST_LIST_FILE + ";cd"
+ functest_utils.execute_command(cmd, logger)
+
logger.debug(" Updating fixed_network_name...")
private_net_name = ""
creds_neutron = openstack_utils.get_credentials("neutron")
@@ -303,25 +315,26 @@ def run_tempest(OPTION):
def main():
global MODE
- if not (args.mode):
- MODE = "smoke"
- elif not (args.mode in modes):
- logger.error("Tempest mode not valid. Possible values are:\n"
- + str(modes))
+
+ if not (args.mode in modes):
+ logger.error("Tempest mode not valid. Possible values are:\n" + str(modes))
exit(-1)
- elif (args.mode == 'custom'):
- MODE = "--tests-file "+REPO_PATH+"testcases/VIM/OpenStack/CI/custom_tests/test_list.txt"
+
+ if args.mode == 'custom' or args.mode == 'smoke' or args.mode == 'full':
+ MODE = "--tests-file " + TEMPEST_LIST_FILE
+ elif args.mode == 'defcore':
+ MODE = "--tests-file " + TEMPEST_DEFCORE
else:
- MODE = "--set "+args.mode
+ MODE = "--set " + args.mode
if args.serial:
- MODE = "--concur 1 "+MODE
+ MODE += " --concur 1"
if not os.path.exists(TEMPEST_RESULTS_DIR):
os.makedirs(TEMPEST_RESULTS_DIR)
create_tempest_resources()
- configure_tempest()
+ configure_tempest(args.mode)
run_tempest(MODE)
if args.noclean: