3 # jose.lausuch@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
10 """ global variables """
16 import functest.ci.tier_builder as tb
17 import functest.utils.functest_utils as ft_utils
18 import functest.utils.functest_vacation as vacation
20 functest_yaml = ft_utils.get_functest_yaml()
22 FUNCTEST_CONF_DIR = functest_yaml.get("general").get(
23 "directories").get("dir_functest_conf")
24 ENV_FILE = FUNCTEST_CONF_DIR + "/env_active"
25 FUNCTEST_REPO = ft_utils.FUNCTEST_REPO
31 CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE')
32 CI_SCENARIO = os.getenv('DEPLOY_SCENARIO')
33 testcases = ft_utils.get_testcases_file()
34 self.tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, testcases)
38 for tier in self.tiers.get_tiers():
39 for test in tier.get_tests():
40 summary += (" %s\n" % test.get_name())
43 def show(self, testname):
44 description = self.tiers.get_test(testname)
45 if description is None:
46 click.echo("The test case '%s' does not exist or is not supported."
49 click.echo(description)
51 def run(self, testname, noclean=False):
52 if testname == 'vacation':
54 elif not os.path.isfile(ENV_FILE):
55 click.echo("Functest environment is not ready. "
56 "Run first 'functest env prepare'")
59 cmd = ("python %s/ci/run_tests.py "
60 "-n -t %s" % (FUNCTEST_REPO, testname))
62 cmd = ("python %s/ci/run_tests.py "
63 "-t %s" % (FUNCTEST_REPO, testname))
64 ft_utils.execute_command(cmd)