aboutsummaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-07-08 17:22:54 +0200
committerJose Lausuch <jose.lausuch@ericsson.com>2016-07-08 15:56:04 +0000
commit57e4df971fcf1d292e37516c247c8e9a08d282a1 (patch)
treec07a91e58d1915d733749223a64a1d4042c6c079 /cli
parent7040e5340d6ac325a9f214db7ac248d136832692 (diff)
Add --noclean option in the CLI
JIRA: FUNCTEST-340 Change-Id: I00cd0a9bf5744bf7ce8998d4bf6427c0766a1322 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/cli_base.py14
-rw-r--r--cli/commands/cli_testcase.py19
-rw-r--r--cli/commands/cli_tier.py19
3 files changed, 36 insertions, 16 deletions
diff --git a/cli/cli_base.py b/cli/cli_base.py
index 583b0ab8..45be1d00 100644
--- a/cli/cli_base.py
+++ b/cli/cli_base.py
@@ -117,8 +117,11 @@ def testcase_show(testname):
@testcase.command('run', help="Executes a test case.")
@click.argument('testname', type=click.STRING, required=True)
-def testcase_run(testname):
- _testcase.run(testname)
+@click.option('-n', '--noclean', is_flag=True, default=False,
+ help='The created openstack resources by the test'
+ 'will not be cleaned after the execution.')
+def testcase_run(testname, noclean):
+ _testcase.run(testname, noclean)
@tier.command('list', help="Lists the available tiers.")
@@ -140,5 +143,8 @@ def tier_gettests(tiername):
@tier.command('run', help="Executes all the tests within a tier.")
@click.argument('tiername', type=click.STRING, required=True)
-def tier_run(tiername):
- _tier.run(tiername)
+@click.option('-n', '--noclean', is_flag=True, default=False,
+ help='The created openstack resources by the tests'
+ 'will not be cleaned after the execution.')
+def tier_run(tiername, noclean):
+ _tier.run(tiername, noclean)
diff --git a/cli/commands/cli_testcase.py b/cli/commands/cli_testcase.py
index 5d546a21..5fe78a59 100644
--- a/cli/commands/cli_testcase.py
+++ b/cli/commands/cli_testcase.py
@@ -7,15 +7,17 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
-import click
+""" global variables """
+
import os
-import yaml
+import click
import functest.ci.tier_builder as tb
import functest.utils.functest_utils as ft_utils
import functest.utils.functest_vacation as vacation
+import yaml
+
-""" global variables """
with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
functest_yaml = yaml.safe_load(f)
@@ -27,6 +29,7 @@ ENV_FILE = FUNCTEST_CONF_DIR + "/env_active"
class CliTestcase:
+
def __init__(self):
CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE')
CI_SCENARIO = os.getenv('DEPLOY_SCENARIO')
@@ -48,13 +51,17 @@ class CliTestcase:
click.echo(description)
- def run(self, testname):
+ def run(self, testname, noclean=False):
if testname == 'vacation':
vacation.main()
elif not os.path.isfile(ENV_FILE):
click.echo("Functest environment is not ready. "
"Run first 'functest env prepare'")
else:
- cmd = ("python /home/opnfv/repos/functest/ci/run_tests.py -t %s"
- % testname)
+ if noclean:
+ cmd = ("python /home/opnfv/repos/functest/ci/run_tests.py "
+ "-t --no-clean %s" % testname)
+ else:
+ cmd = ("python /home/opnfv/repos/functest/ci/run_tests.py "
+ "-t %s" % testname)
ft_utils.execute_command(cmd)
diff --git a/cli/commands/cli_tier.py b/cli/commands/cli_tier.py
index a872eb76..4b714c28 100644
--- a/cli/commands/cli_tier.py
+++ b/cli/commands/cli_tier.py
@@ -7,14 +7,16 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
-import click
+""" global variables """
+
import os
-import yaml
+import click
import functest.ci.tier_builder as tb
import functest.utils.functest_utils as ft_utils
+import yaml
+
-""" global variables """
with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
functest_yaml = yaml.safe_load(f)
@@ -26,6 +28,7 @@ ENV_FILE = FUNCTEST_CONF_DIR + "/env_active"
class CliTier:
+
def __init__(self):
CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE')
CI_SCENARIO = os.getenv('DEPLOY_SCENARIO')
@@ -60,11 +63,15 @@ class CliTier:
tests = tier.get_test_names()
click.echo("Test cases in tier '%s':\n %s\n" % (tiername, tests))
- def run(self, tiername):
+ def run(self, tiername, noclean=False):
if not os.path.isfile(ENV_FILE):
click.echo("Functest environment is not ready. "
"Run first 'functest env prepare'")
else:
- cmd = ("python /home/opnfv/repos/functest/ci/run_tests.py -t %s"
- % tiername)
+ if noclean:
+ cmd = ("python /home/opnfv/repos/functest/ci/run_tests.py "
+ "-t --no-clean %s" % tiername)
+ else:
+ cmd = ("python /home/opnfv/repos/functest/ci/run_tests.py "
+ "-t %s" % tiername)
ft_utils.execute_command(cmd)