X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Fcli%2Fcommands%2Fcli_testcase.py;h=3d3f1cb3e400c9cfbed4753dfdf25f94ad773a04;hb=refs%2Fchanges%2F55%2F34955%2F1;hp=510d740ba10f8cbf34f57c451411b533b6381563;hpb=6dce2ff0b0bf7e5819eaca161b7e67f954479f1b;p=functest.git diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py index 510d740ba..3d3f1cb3e 100644 --- a/functest/cli/commands/cli_testcase.py +++ b/functest/cli/commands/cli_testcase.py @@ -14,23 +14,18 @@ import os import click import functest.ci.tier_builder as tb +from functest.utils.constants import CONST import functest.utils.functest_utils as ft_utils import functest.utils.functest_vacation as vacation -FUNCTEST_CONF_DIR = \ - ft_utils.get_functest_config('general.directories.dir_functest_conf') -ENV_FILE = FUNCTEST_CONF_DIR + "/env_active" -FUNCTEST_REPO = ft_utils.FUNCTEST_REPO - - -class CliTestcase: +class CliTestcase(object): def __init__(self): - CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE') - CI_SCENARIO = os.getenv('DEPLOY_SCENARIO') - testcases = ft_utils.get_testcases_file() - self.tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, testcases) + self.tiers = tb.TierBuilder( + CONST.__getattribute__('INSTALLER_TYPE'), + CONST.__getattribute__('DEPLOY_SCENARIO'), + CONST.__getattribute__('functest_testcases_yaml')) def list(self): summary = "" @@ -47,17 +42,25 @@ class CliTestcase: click.echo(description) - def run(self, testname, noclean=False): + @staticmethod + def run(testname, noclean=False, report=False): + + flags = "" + if noclean: + flags += "-n " + if report: + flags += "-r " + if testname == 'vacation': vacation.main() - elif not os.path.isfile(ENV_FILE): + elif not os.path.isfile(CONST.__getattribute__('env_active')): click.echo("Functest environment is not ready. " "Run first 'functest env prepare'") else: - if noclean: - cmd = ("python %s/ci/run_tests.py " - "-n -t %s" % (FUNCTEST_REPO, testname)) - else: - cmd = ("python %s/ci/run_tests.py " - "-t %s" % (FUNCTEST_REPO, testname)) - ft_utils.execute_command(cmd) + tests = testname.split(",") + for test in tests: + cmd = ("python %s/functest/ci/run_tests.py " + "%s -t %s" % + (CONST.__getattribute__('dir_repo_functest'), + flags, test)) + ft_utils.execute_command(cmd)