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
14 import functest.ci.tier_builder as tb
15 import functest.utils.functest_utils as ft_utils
17 """ global variables """
18 with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
19 functest_yaml = yaml.safe_load(f)
21 REPOS_DIR = os.getenv('repos_dir')
22 FUNCTEST_REPO = ("%s/functest/" % REPOS_DIR)
23 FUNCTEST_CONF_DIR = functest_yaml.get("general").get(
24 "directories").get("dir_functest_conf")
25 ENV_FILE = FUNCTEST_CONF_DIR + "/env_active"
30 CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE')
31 CI_SCENARIO = os.getenv('DEPLOY_SCENARIO')
32 testcases = FUNCTEST_REPO + "/ci/testcases.yaml"
33 self.tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, testcases)
37 for tier in self.tiers.get_tiers():
38 for test in tier.get_tests():
39 summary += (" %s\n" % test.get_name())
42 def show(self, testname):
43 description = self.tiers.get_test(testname)
44 if description is None:
45 click.echo("The test case '%s' does not exist or is not supported."
48 click.echo(description)
50 def run(self, testname):
51 if not os.path.isfile(ENV_FILE):
52 click.echo("Functest environment is not ready. "
53 "Run first 'functest env prepare'")
55 cmd = ("python /home/opnfv/repos/functest/ci/run_tests.py -t %s"
57 ft_utils.execute_command(cmd)