aboutsummaryrefslogtreecommitdiffstats
path: root/functest/ci/run_tests.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-12-21 15:42:54 +0800
committerjose.lausuch <jose.lausuch@ericsson.com>2016-12-21 12:55:44 +0100
commita59fea1046d167b4609c9b86836d178e799dc688 (patch)
tree64972a06ba7d10bbde13e63345136126dfa10a6e /functest/ci/run_tests.py
parent3592444c8abcaca3312d831fd610d82bffd627ea (diff)
Refactor test run related modules using new constants provider
JIRA: FUNCTEST-673 Change-Id: Ia37fb5a08c8fbc4a8acb666565ea887f9ae48b83 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'functest/ci/run_tests.py')
-rwxr-xr-xfunctest/ci/run_tests.py37
1 files changed, 17 insertions, 20 deletions
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index 557ba08dd..7aac9d2cf 100755
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -8,24 +8,23 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import argparse
import datetime
import importlib
import os
import re
import sys
-import argparse
-
import functest.ci.generate_report as generate_report
import functest.ci.tier_builder as tb
import functest.core.testcase_base as testcase_base
+import functest.utils.functest_constants as ft_constants
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
-import functest.utils.functest_constants as ft_constants
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.utils.constants import CONST
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--test", dest="test", action='store',
@@ -44,7 +43,7 @@ logger = ft_logger.Logger("run_tests").getLogger()
""" global variables """
-EXEC_SCRIPT = ("%s/functest/ci/exec_test.sh" % ft_constants.FUNCTEST_REPO_DIR)
+EXEC_SCRIPT = ("%s/functest/ci/exec_test.sh" % CONST.dir_repo_functest)
# This will be the return code of this script. If any of the tests fails,
# this variable will change to -1
@@ -65,7 +64,7 @@ def print_separator(str, count=45):
def source_rc_file():
- rc_file = ft_constants.OPENSTACK_CREDS
+ rc_file = CONST.openstack_creds
if not os.path.isfile(rc_file):
logger.error("RC file %s does not exist..." % rc_file)
sys.exit(1)
@@ -75,16 +74,20 @@ def source_rc_file():
if re.search("OS_", key):
if key == 'OS_AUTH_URL':
ft_constants.OS_AUTH_URL = value
+ CONST.OS_AUTH_URL = value
elif key == 'OS_USERNAME':
ft_constants.OS_USERNAME = value
+ CONST.OS_USERNAME = value
elif key == 'OS_TENANT_NAME':
ft_constants.OS_TENANT_NAME = value
+ CONST.OS_TENANT_NAME = value
elif key == 'OS_PASSWORD':
ft_constants.OS_PASSWORD = value
- logger.debug("OS_AUTH_URL:%s" % ft_constants.OS_AUTH_URL)
- logger.debug("OS_USERNAME:%s" % ft_constants.OS_USERNAME)
- logger.debug("OS_TENANT_NAME:%s" % ft_constants.OS_TENANT_NAME)
- logger.debug("OS_PASSWORD:%s" % ft_constants.OS_PASSWORD)
+ CONST.OS_PASSWORD = value
+ logger.debug("OS_AUTH_URL:%s" % CONST.OS_AUTH_URL)
+ logger.debug("OS_USERNAME:%s" % CONST.OS_USERNAME)
+ logger.debug("OS_TENANT_NAME:%s" % CONST.OS_TENANT_NAME)
+ logger.debug("OS_PASSWORD:%s" % CONST.OS_PASSWORD)
def generate_os_snapshot():
@@ -201,17 +204,11 @@ def run_tier(tier):
def run_all(tiers):
summary = ""
- BUILD_TAG = ft_constants.CI_BUILD_TAG
- if BUILD_TAG is not None and re.search("daily", BUILD_TAG) is not None:
- CI_LOOP = "daily"
- else:
- CI_LOOP = "weekly"
-
tiers_to_run = []
for tier in tiers.get_tiers():
if (len(tier.get_tests()) != 0 and
- re.search(CI_LOOP, tier.get_ci_loop()) is not None):
+ re.search(CONST.CI_LOOP, tier.get_ci_loop()) is not None):
tiers_to_run.append(tier)
summary += ("\n - %s:\n\t %s"
% (tier.get_name(),
@@ -227,10 +224,10 @@ def run_all(tiers):
def main():
- CI_INSTALLER_TYPE = ft_constants.CI_INSTALLER_TYPE
- CI_SCENARIO = ft_constants.CI_SCENARIO
+ CI_INSTALLER_TYPE = CONST.INSTALLER_TYPE
+ CI_SCENARIO = CONST.DEPLOY_SCENARIO
- file = ft_constants.FUNCTEST_TESTCASES_YAML
+ file = CONST.functest_testcases_yaml
_tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, file)
if args.noclean: