# http://www.apache.org/licenses/LICENSE-2.0
#
-import click
+""" global variables """
+
import os
-import yaml
+
+import click
import functest.ci.tier_builder as tb
import functest.utils.functest_utils as ft_utils
-""" global variables """
-with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
- functest_yaml = yaml.safe_load(f)
+functest_yaml = ft_utils.get_functest_yaml()
-REPOS_DIR = os.getenv('repos_dir')
-FUNCTEST_REPO = ("%s/functest/" % REPOS_DIR)
FUNCTEST_CONF_DIR = functest_yaml.get("general").get(
"directories").get("dir_functest_conf")
ENV_FILE = FUNCTEST_CONF_DIR + "/env_active"
+FUNCTEST_REPO = ft_utils.FUNCTEST_REPO
class CliTier:
+
def __init__(self):
CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE')
CI_SCENARIO = os.getenv('DEPLOY_SCENARIO')
- testcases = FUNCTEST_REPO + "/ci/testcases.yaml"
+ testcases = ft_utils.get_testcases_file()
self.tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, testcases)
def list(self):
tests = tier.get_test_names()
click.echo("Test cases in tier '%s':\n %s\n" % (tiername, tests))
- def run(self, tiername):
+ def run(self, tiername, noclean=False):
if not os.path.isfile(ENV_FILE):
click.echo("Functest environment is not ready. "
"Run first 'functest env prepare'")
else:
- cmd = ("python /home/opnfv/repos/functest/ci/run_tests.py -t %s"
- % tiername)
+ if noclean:
+ cmd = ("python %s/ci/run_tests.py "
+ "-n -t %s" % (FUNCTEST_REPO, tiername))
+ else:
+ cmd = ("python %s/ci/run_tests.py "
+ "-t %s" % (FUNCTEST_REPO, tiername))
ft_utils.execute_command(cmd)