X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Fcli%2Fcommands%2Fcli_tier.py;h=531f0ff96a221ad1eb6163018499caa8dfdf3bc0;hb=refs%2Fchanges%2F55%2F34955%2F1;hp=fa2de587cb88b27f081f2761587f3e965d0e068a;hpb=cd2e2d67016b78517f86a2cafad9f3f23adc94d7;p=functest.git diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py index fa2de587c..531f0ff96 100644 --- a/functest/cli/commands/cli_tier.py +++ b/functest/cli/commands/cli_tier.py @@ -14,22 +14,17 @@ 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 -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 CliTier: +class CliTier(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 = "" @@ -59,15 +54,21 @@ class CliTier: tests = tier.get_test_names() click.echo("Test cases in tier '%s':\n %s\n" % (tiername, tests)) - def run(self, tiername, noclean=False): - if not os.path.isfile(ENV_FILE): + @staticmethod + def run(tiername, noclean=False, report=False): + + flags = "" + if noclean: + flags += "-n " + if report: + flags += "-r " + + if 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/functest/ci/run_tests.py " - "-n -t %s" % (FUNCTEST_REPO, tiername)) - else: - cmd = ("python %s/functest/ci/run_tests.py " - "-t %s" % (FUNCTEST_REPO, tiername)) + cmd = ("python %s/functest/ci/run_tests.py " + "%s -t %s" % + (CONST.__getattribute__('dir_repo_functest'), + flags, tiername)) ft_utils.execute_command(cmd)