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_constants as ft_constants
24 CI_INSTALLER_TYPE = ft_constants.CI_INSTALLER_TYPE
25 CI_SCENARIO = ft_constants.CI_SCENARIO
26 testcases = ft_constants.FUNCTEST_TESTCASES_YAML
27 self.tiers = tb.TierBuilder(CI_INSTALLER_TYPE, CI_SCENARIO, testcases)
31 for tier in self.tiers.get_tiers():
32 summary += (" - %s. %s:\n\t %s\n"
35 tier.get_test_names()))
38 def show(self, tiername):
39 tier = self.tiers.get_tier(tiername)
41 tier_names = self.tiers.get_tier_names()
42 click.echo("The tier with name '%s' does not exist. "
43 "Available tiers are:\n %s\n" % (tiername, tier_names))
45 click.echo(self.tiers.get_tier(tiername))
47 def gettests(self, tiername):
48 tier = self.tiers.get_tier(tiername)
50 tier_names = self.tiers.get_tier_names()
51 click.echo("The tier with name '%s' does not exist. "
52 "Available tiers are:\n %s\n" % (tiername, tier_names))
54 tests = tier.get_test_names()
55 click.echo("Test cases in tier '%s':\n %s\n" % (tiername, tests))
57 def run(self, tiername, noclean=False):
58 if not os.path.isfile(ft_constants.ENV_FILE):
59 click.echo("Functest environment is not ready. "
60 "Run first 'functest env prepare'")
63 cmd = ("python %s/functest/ci/run_tests.py "
64 "-n -t %s" % (ft_constants.FUNCTEST_REPO_DIR, tiername))
66 cmd = ("python %s/functest/ci/run_tests.py "
67 "-t %s" % (ft_constants.FUNCTEST_REPO_DIR, tiername))
68 ft_utils.execute_command(cmd)