aboutsummaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ci')
-rwxr-xr-xci/exec_test.sh2
-rwxr-xr-xci/prepare_env.py2
-rwxr-xr-xci/run_tests.py44
-rw-r--r--ci/testcases.yaml3
4 files changed, 41 insertions, 10 deletions
diff --git a/ci/exec_test.sh b/ci/exec_test.sh
index ad1e56372..6fdc42666 100755
--- a/ci/exec_test.sh
+++ b/ci/exec_test.sh
@@ -161,7 +161,7 @@ function run_test(){
"odl-sfc")
ODL_SFC_DIR=${FUNCTEST_REPO_DIR}/testcases/features/sfc
# pass FUNCTEST_REPO_DIR inside prepare_odl_sfc.bash
- FUNCTEST_REPO_DIR=${FUNCTEST_REPO_DIR} bash ${ODL_SFC_DIR}/prepare_odl_sfc.bash || exit $?
+ FUNCTEST_REPO_DIR=${FUNCTEST_REPO_DIR} python ${ODL_SFC_DIR}/prepare_odl_sfc.py || exit $?
source ${ODL_SFC_DIR}/tackerc
python ${ODL_SFC_DIR}/sfc_colorado1.py $report
;;
diff --git a/ci/prepare_env.py b/ci/prepare_env.py
index 6b1babaa8..e110aa572 100755
--- a/ci/prepare_env.py
+++ b/ci/prepare_env.py
@@ -223,7 +223,7 @@ def install_rally():
logger.info("Creating Rally environment...")
cmd = "rally deployment destroy opnfv-rally"
- ft_utils.execute_command(cmd, exit_on_error=False,
+ ft_utils.execute_command(cmd,
error_msg=("Deployment %s does not exist."
% DEPLOYMENT_MAME), verbose=False)
rally_conf = os_utils.get_credentials_for_rally()
diff --git a/ci/run_tests.py b/ci/run_tests.py
index af8f51dd0..f30062f75 100755
--- a/ci/run_tests.py
+++ b/ci/run_tests.py
@@ -9,6 +9,7 @@
#
import datetime
+import importlib
import os
import re
import sys
@@ -17,12 +18,13 @@ import argparse
import functest.ci.generate_report as generate_report
import functest.ci.tier_builder as tb
+import functest.core.TestCasesBase as TestCasesBase
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_clean as os_clean
import functest.utils.openstack_snapshot as os_snapshot
import functest.utils.openstack_utils as os_utils
-from functest.testcases.Controllers.ODL.OpenDaylightTesting import ODLTestCases
+
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--test", dest="test", action='store',
@@ -82,6 +84,19 @@ def update_test_info(test_name, result, duration):
"duration": duration})
+def get_run_dict_if_defined(testname):
+ try:
+ dict = ft_utils.get_dict_by_test(testname)
+ if not dict:
+ logger.error("Cannot get {}'s config options".format(testname))
+ elif 'run' in dict:
+ return dict['run']
+ return None
+ except Exception:
+ logger.exception("Cannot get {}'s config options".format(testname))
+ return None
+
+
def run_test(test, tier_name):
global OVERALL_RESULT, EXECUTED_TEST_CASES
result_str = "PASS"
@@ -100,15 +115,28 @@ def run_test(test, tier_name):
if REPORT_FLAG:
flags += " -r"
- if test_name == 'odl':
- result = ODLTestCases.functest_run()
- if result and REPORT_FLAG:
- result = ODLTestCases.push_to_db()
- result = not result
+ result = TestCasesBase.TestCasesBase.EX_RUN_ERROR
+ run_dict = get_run_dict_if_defined(test_name)
+ if run_dict:
+ try:
+ module = importlib.import_module(run_dict['module'])
+ cls = getattr(module, run_dict['class'])
+ test_case = cls()
+ result = test_case.run()
+ if result == TestCasesBase.TestCasesBase.EX_OK and REPORT_FLAG:
+ result = test_case.push_to_db()
+ except ImportError:
+ logger.exception("Cannot import module {}".format(
+ run_dict['module']))
+ except AttributeError:
+ logger.exception("Cannot get class {}".format(
+ run_dict['class']))
else:
cmd = ("%s%s" % (EXEC_SCRIPT, flags))
- logger.debug("Executing command '%s'" % cmd)
- result = ft_utils.execute_command(cmd, exit_on_error=False)
+ logger.info("Executing command {} because {} "
+ "doesn't implement the new framework".format(
+ cmd, test_name))
+ result = ft_utils.execute_command(cmd)
if CLEAN_FLAG:
cleanup()
diff --git a/ci/testcases.yaml b/ci/testcases.yaml
index 02b69ec8b..22509e611 100644
--- a/ci/testcases.yaml
+++ b/ci/testcases.yaml
@@ -92,6 +92,9 @@ tiers:
dependencies:
installer: ''
scenario: 'odl'
+ run:
+ module: 'functest.testcases.Controllers.ODL.OpenDaylightTesting'
+ class: 'ODLTestCases'
-
name: onos