aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/run_tempest.py49
-rw-r--r--testcases/tests/TestFunctestUtils.py97
2 files changed, 25 insertions, 121 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
index d29869a04..4b1f0ffae 100644
--- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py
@@ -28,8 +28,8 @@ import keystoneclient.v2_0.client as ksclient
from neutronclient.v2_0 import client as neutronclient
import functest.utils.functest_logger as ft_logger
-import functest.utils.functest_utils as functest_utils
-import functest.utils.openstack_utils as openstack_utils
+import functest.utils.functest_utils as ft_utils
+import functest.utils.openstack_utils as os_utils
modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing',
'identity', 'image', 'network', 'object_storage', 'orchestration',
@@ -113,10 +113,10 @@ def push_results_to_db(case, payload, criteria):
# TODO move DB creds into config file
url = TEST_DB + "/results"
- installer = functest_utils.get_installer_type(logger)
- scenario = functest_utils.get_scenario(logger)
- version = functest_utils.get_version(logger)
- pod_name = functest_utils.get_pod_name(logger)
+ installer = ft_utils.get_installer_type(logger)
+ scenario = ft_utils.get_scenario(logger)
+ version = ft_utils.get_version(logger)
+ pod_name = ft_utils.get_pod_name(logger)
logger.info("Pushing results to DB: '%s'." % url)
@@ -131,38 +131,38 @@ def push_results_to_db(case, payload, criteria):
def create_tempest_resources():
- ks_creds = openstack_utils.get_credentials("keystone")
+ ks_creds = os_utils.get_credentials("keystone")
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_id = os_utils.create_tenant(keystone,
+ 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)
+ user_id = os_utils.create_user(keystone, USER_NAME, USER_PASSWORD,
+ None, tenant_id)
if user_id == '':
logger.error("Error : Failed to create %s user" % USER_NAME)
def free_tempest_resources():
- ks_creds = openstack_utils.get_credentials("keystone")
+ ks_creds = os_utils.get_credentials("keystone")
logger.info("Deleting tenant and user for Tempest suite)")
keystone = ksclient.Client(**ks_creds)
- user_id = openstack_utils.get_user_id(keystone, USER_NAME)
+ user_id = os_utils.get_user_id(keystone, USER_NAME)
if user_id == '':
logger.error("Error : Failed to get id of %s user" % USER_NAME)
else:
- if not openstack_utils.delete_user(keystone, user_id):
+ if not os_utils.delete_user(keystone, user_id):
logger.error("Error : Failed to delete %s user" % USER_NAME)
- tenant_id = openstack_utils.get_tenant_id(keystone, TENANT_NAME)
+ tenant_id = os_utils.get_tenant_id(keystone, TENANT_NAME)
if tenant_id == '':
logger.error("Error : Failed to get id of %s tenant" % TENANT_NAME)
else:
- if not openstack_utils.delete_tenant(keystone, tenant_id):
+ if not os_utils.delete_tenant(keystone, tenant_id):
logger.error("Error : Failed to delete %s tenant" % TENANT_NAME)
@@ -173,7 +173,7 @@ def configure_tempest(mode):
logger.debug("Generating tempest.conf file...")
cmd = "rally verify genconfig"
- functest_utils.execute_command(cmd, logger)
+ ft_utils.execute_command(cmd, logger)
logger.debug("Resolving deployment UUID and directory...")
cmd = "rally deployment list | awk '/" + DEPLOYMENT_MAME + "/ {print $2}'"
@@ -198,18 +198,18 @@ def configure_tempest(mode):
cmd = "cd " + deployment_dir + ";"
if mode == 'smoke':
cmd += "testr list-tests smoke >" + TEMPEST_LIST_FILE + ";cd"
- functest_utils.execute_command(cmd, logger)
+ ft_utils.execute_command(cmd, logger)
elif mode == 'full':
cmd += "testr list-tests >" + TEMPEST_LIST_FILE + ";cd"
- functest_utils.execute_command(cmd, logger)
+ ft_utils.execute_command(cmd, logger)
logger.debug("Updating selected tempest.conf parameters...")
config = ConfigParser.RawConfigParser()
config.read(tempest_conf_file)
private_net_name = ""
- creds_neutron = openstack_utils.get_credentials("neutron")
+ creds_neutron = os_utils.get_credentials("neutron")
neutron_client = neutronclient.Client(**creds_neutron)
- private_net = openstack_utils.get_private_net(neutron_client)
+ private_net = os_utils.get_private_net(neutron_client)
if private_net is None:
logger.error("No shared private networks found.")
else:
@@ -238,7 +238,7 @@ def run_tempest(OPTION):
CI_DEBUG = os.environ.get("CI_DEBUG")
if CI_DEBUG == "true" or CI_DEBUG == "True":
- subprocess.call(cmd_line, shell=True, stderr=subprocess.STDOUT)
+ ft_utils.execute_command(cmd_line, logger, exit_on_error=True)
else:
header = ("Tempest environment:\n"
" Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" %
@@ -259,7 +259,8 @@ def run_tempest(OPTION):
f_env.close()
cmd_line = "rally verify show"
- subprocess.call(cmd_line, shell=True)
+ ft_utils.execute_command(cmd_line, logger,
+ exit_on_error=True, info=True)
cmd_line = "rally verify list"
logger.debug('Executing command : {}'.format(cmd_line))
diff --git a/testcases/tests/TestFunctestUtils.py b/testcases/tests/TestFunctestUtils.py
deleted file mode 100644
index 4e06b3e48..000000000
--- a/testcases/tests/TestFunctestUtils.py
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/python
-
-import os
-import unittest
-import yaml
-from functest_utils import getTestEnv, isTestRunnable, generateTestcaseList
-
-
-class TestFunctestUtils(unittest.TestCase):
-
- def setUp(self):
- os.environ["INSTALLER_TYPE"] = "fuel"
- os.environ["DEPLOY_SCENARIO"] = "os-odl_l3-ovs-ha"
-
- global functest_yaml
-
- with open("../config_functest.yaml") as f:
- functest_yaml = yaml.safe_load(f)
- f.close()
-
- def test_getTestEnv(self):
-
- env_test = getTestEnv('ovno', functest_yaml)
- self.assertEqual(env_test, {'scenario': 'ocl'})
-
- env_test = getTestEnv('doctor', functest_yaml)
- self.assertEqual(env_test, {'installer': 'fuel'})
-
- env_test = getTestEnv('promise', functest_yaml)
- self.assertEqual(env_test, {'installer': '(fuel)|(joid)'})
-
- env_test = getTestEnv('functest/tempest', functest_yaml)
- self.assertEqual(env_test, None)
-
- env_test = getTestEnv('functest/vims', functest_yaml)
- self.assertEqual(env_test, None)
-
- env_test = getTestEnv('functest/odl', functest_yaml)
- self.assertEqual(env_test, {'scenario': 'odl'})
-
- env_test = getTestEnv('functest/onos', functest_yaml)
- self.assertEqual(env_test, {'scenario': 'onos'})
-
- env_test = getTestEnv('policy-test', functest_yaml)
- self.assertEqual(env_test, {'scenario': 'odl'})
-
- env_test = getTestEnv('foo', functest_yaml)
- self.assertEqual(env_test, '')
-
- def test_isTestRunnable(self):
-
- test = isTestRunnable('ovno', functest_yaml)
- self.assertFalse(test)
-
- test = isTestRunnable('doctor', functest_yaml)
- self.assertTrue(test)
-
- test = isTestRunnable('promise', functest_yaml)
- self.assertTrue(test)
-
- test = isTestRunnable('functest/onos', functest_yaml)
- self.assertFalse(test)
-
- test = isTestRunnable('functest/odl', functest_yaml)
- self.assertTrue(test)
-
- test = isTestRunnable('functest/vping_ssh', functest_yaml)
- self.assertTrue(test)
-
- test = isTestRunnable('functest/vping_userdata', functest_yaml)
- self.assertTrue(test)
-
- test = isTestRunnable('functest/tempest', functest_yaml)
- self.assertTrue(test)
-
- test = isTestRunnable('functest/rally', functest_yaml)
- self.assertTrue(test)
-
- test = isTestRunnable('functest/vims', functest_yaml)
- self.assertTrue(test)
-
- def test_generateTestcaseList(self):
-
- test = generateTestcaseList(functest_yaml)
-
- expected_list = ("vping_ssh vping_userdata tempest odl doctor " +
- "promise policy-test odl-vpn_service-tests vims " +
- "rally ")
- self.assertEqual(test, expected_list)
-
- def tearDown(self):
- os.environ["INSTALLER_TYPE"] = ""
- os.environ["DEPLOY_SCENARIO"] = ""
-
-
-if __name__ == '__main__':
- unittest.main()