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
21 ft_utils.get_functest_config('general.directories.dir_functest_conf')
22 ENV_FILE = FUNCTEST_CONF_DIR + "/env_active"
23 FUNCTEST_REPO = ft_utils.FUNCTEST_REPO
29 CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE')
30 CI_SCENARIO = os.getenv('DEPLOY_SCENARIO')
31 testcases = ft_utils.get_testcases_file()
32 self.tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, testcases)
36 for tier in self.tiers.get_tiers():
37 summary += (" - %s. %s:\n\t %s\n"
40 tier.get_test_names()))
43 def show(self, tiername):
44 tier = self.tiers.get_tier(tiername)
46 tier_names = self.tiers.get_tier_names()
47 click.echo("The tier with name '%s' does not exist. "
48 "Available tiers are:\n %s\n" % (tiername, tier_names))
50 click.echo(self.tiers.get_tier(tiername))
52 def gettests(self, tiername):
53 tier = self.tiers.get_tier(tiername)
55 tier_names = self.tiers.get_tier_names()
56 click.echo("The tier with name '%s' does not exist. "
57 "Available tiers are:\n %s\n" % (tiername, tier_names))
59 tests = tier.get_test_names()
60 click.echo("Test cases in tier '%s':\n %s\n" % (tiername, tests))
62 def run(self, tiername, noclean=False):
63 if not os.path.isfile(ENV_FILE):
64 click.echo("Functest environment is not ready. "
65 "Run first 'functest env prepare'")
68 cmd = ("python %s/ci/run_tests.py "
69 "-n -t %s" % (FUNCTEST_REPO, tiername))
71 cmd = ("python %s/ci/run_tests.py "
72 "-t %s" % (FUNCTEST_REPO, tiername))
73 ft_utils.execute_command(cmd)