diff options
author | Helen Yao <yaohelan@huawei.com> | 2016-12-28 09:16:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-12-28 09:16:36 +0000 |
commit | 254a7e643bccd48bf562f8362745783dfb9542b4 (patch) | |
tree | c333dc67cbdaa199ba932555cc16b91ef3a6fb50 | |
parent | 598b77988aa6ba2004c8b99b8fe09dbf09e560fa (diff) | |
parent | daa4407e8a40e7eb2083335bb394d7200d4ea576 (diff) |
Merge "Add a flag in the CLI to report results to DB"
-rw-r--r-- | functest/cli/cli_base.py | 14 | ||||
-rw-r--r-- | functest/cli/commands/cli_testcase.py | 17 | ||||
-rw-r--r-- | functest/cli/commands/cli_tier.py | 17 |
3 files changed, 30 insertions, 18 deletions
diff --git a/functest/cli/cli_base.py b/functest/cli/cli_base.py index 3b14fa336..cc697ed7e 100644 --- a/functest/cli/cli_base.py +++ b/functest/cli/cli_base.py @@ -121,8 +121,11 @@ def testcase_show(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) +@click.option('-r', '--report', is_flag=True, default=False, + help='Push results to the results DataBase. Only CI Pods' + 'have rights to do that.') +def testcase_run(testname, noclean, report): + _testcase.run(testname, noclean, report) @tier.command('list', help="Lists the available tiers.") @@ -147,5 +150,8 @@ def tier_gettests(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) +@click.option('-r', '--report', is_flag=True, default=False, + help='Push results to the results DataBase. Only CI Pods' + 'have rights to do that.') +def tier_run(tiername, noclean, report): + _tier.run(tiername, noclean, report) diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py index d019632ab..b6566245a 100644 --- a/functest/cli/commands/cli_testcase.py +++ b/functest/cli/commands/cli_testcase.py @@ -42,7 +42,14 @@ class CliTestcase: click.echo(description) @staticmethod - def run(testname, noclean=False): + def run(testname, noclean=False, report=False): + + flags = "" + if noclean: + flags += "-n " + if report: + flags += "-r " + if testname == 'vacation': vacation.main() elif not os.path.isfile(CONST.env_active): @@ -51,10 +58,6 @@ class CliTestcase: else: tests = testname.split(",") for test in tests: - if noclean: - cmd = ("python %s/functest/ci/run_tests.py " - "-n -t %s" % (CONST.dir_repo_functest, test)) - else: - cmd = ("python %s/functest/ci/run_tests.py " - "-t %s" % (CONST.dir_repo_functest, test)) + cmd = ("python %s/functest/ci/run_tests.py " + "%s -t %s" % (CONST.dir_repo_functest, flags, test)) ft_utils.execute_command(cmd) diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py index 01208498b..b9d25b6d0 100644 --- a/functest/cli/commands/cli_tier.py +++ b/functest/cli/commands/cli_tier.py @@ -54,15 +54,18 @@ class CliTier: click.echo("Test cases in tier '%s':\n %s\n" % (tiername, tests)) @staticmethod - def run(tiername, noclean=False): + def run(tiername, noclean=False, report=False): + + flags = "" + if noclean: + flags += "-n " + if report: + flags += "-r " + if not os.path.isfile(CONST.env_active): click.echo("Functest environment is not ready. " "Run first 'functest env prepare'") else: - if noclean: - cmd = ("python %s/functest/ci/run_tests.py " - "-n -t %s" % (CONST.dir_repo_functest, tiername)) - else: - cmd = ("python %s/functest/ci/run_tests.py " - "-t %s" % (CONST.dir_repo_functest, tiername)) + cmd = ("python %s/functest/ci/run_tests.py " + "%s -t %s" % (CONST.dir_repo_functest, flags, tiername)) ft_utils.execute_command(cmd) |