diff --git a/etc/rally.bash_completion b/etc/rally.bash_completion index 022e641bb0..da510677f8 100644 --- a/etc/rally.bash_completion +++ b/etc/rally.bash_completion @@ -55,7 +55,7 @@ _rally() OPTS["verify_list-verifier-tests"]="--id --pattern" OPTS["verify_list-verifiers"]="--status" OPTS["verify_report"]="--uuid --type --to --open" - OPTS["verify_rerun"]="--uuid --deployment-id --failed --detailed --no-use" + OPTS["verify_rerun"]="--uuid --deployment-id --failed --tag --concurrency --detailed --no-use" OPTS["verify_show"]="--uuid --sort-by --detailed" OPTS["verify_show-verifier"]="--id" OPTS["verify_start"]="--id --deployment-id --tag --pattern --concurrency --load-list --skip-list --xfail-list --detailed --no-use" diff --git a/rally/api.py b/rally/api.py index 66fc5474d6..6f561a80c6 100644 --- a/rally/api.py +++ b/rally/api.py @@ -879,15 +879,22 @@ class _Verification(object): return verification, results @classmethod - def rerun(cls, verification_uuid, deployment_id=None, failed=False): + def rerun(cls, verification_uuid, deployment_id=None, failed=False, + tags=None, concurrency=0): """Rerun tests from a verification. :param verification_uuid: Verification UUID :param deployment_id: Deployment name or UUID :param failed: Rerun only failed tests + :param tags: List of tags to assign them to verification + :param concurrency: The number of processes to use to run verifier + tests """ # TODO(ylobankov): Improve this method in the future: put some # information about re-run in run_args. + run_args = {} + if concurrency: + run_args["concurrency"] = concurrency verification = cls.get(verification_uuid) tests = verification.tests @@ -906,8 +913,9 @@ class _Verification(object): LOG.info("Re-running %stests from verification (UUID=%s) for " "deployment '%s' (UUID=%s).", "failed " if failed else "", verification.uuid, deployment["name"], deployment["uuid"]) - return cls.start(verification.verifier_uuid, deployment["uuid"], - load_list=tests) + return cls.start( + verification.verifier_uuid, deployment["uuid"], load_list=tests, + tags=tags, **run_args) @staticmethod def get(verification_uuid): diff --git a/rally/cli/commands/verify.py b/rally/cli/commands/verify.py index 2ad744714b..dbeebf40b8 100644 --- a/rally/cli/commands/verify.py +++ b/rally/cli/commands/verify.py @@ -414,8 +414,9 @@ class VerifyCommands(object): "in case of Tempest you can specify 'set=smoke').") @cliutils.args("--concurrency", dest="concur", type=int, metavar="", required=False, - help="How many processes to use to run verifier tests. " - "The default value (0) auto-detects your CPU count.") + help="How many processes to be used for running verifier " + "tests. The default value (0) auto-detects your CPU " + "count.") @cliutils.args("--load-list", dest="load_list", type=str, metavar="", required=False, help="Path to a file with a list of tests to run.") @@ -515,6 +516,13 @@ class VerifyCommands(object): help="Deployment name or UUID. " + LIST_DEPLOYMENTS_HINT) @cliutils.args("--failed", dest="failed", required=False, help="Rerun only failed tests.", action="store_true") + @cliutils.args("--tag", nargs="+", dest="tags", type=str, required=False, + help="Mark verification with a tag or a few tags.") + @cliutils.args("--concurrency", dest="concur", type=int, metavar="", + required=False, + help="How many processes to be used for running verifier " + "tests. The default value (0) auto-detects your CPU " + "count.") @cliutils.args("--detailed", dest="detailed", action="store_true", required=False, help="Show verification details such as errors of failed " @@ -525,11 +533,14 @@ class VerifyCommands(object): @envutils.with_default_verification_uuid @envutils.with_default_deployment(cli_arg_name="deployment-id") @plugins.ensure_plugins_are_loaded - def rerun(self, api, verification_uuid=None, deployment=None, - failed=False, detailed=False, do_use=True): + def rerun(self, api, verification_uuid=None, deployment=None, tags=None, + concur=None, failed=False, detailed=False, do_use=True): """Rerun tests from a verification for a specific deployment.""" verification, results = api.verification.rerun(verification_uuid, - deployment, failed) + deployment=deployment, + failed=failed, + tags=tags, + concur=concur) if detailed: self._print_details_after_run(results) diff --git a/tests/unit/cli/commands/test_verify.py b/tests/unit/cli/commands/test_verify.py index 1c2155dd81..1f51b8041f 100644 --- a/tests/unit/cli/commands/test_verify.py +++ b/tests/unit/cli/commands/test_verify.py @@ -359,9 +359,9 @@ class VerifyCommandsTestCase(test.TestCase): "failures": 0}) self.fake_api.verification.rerun.return_value = (verification, results) - self.verify.rerun(self.fake_api, "v_uuid", "d_id", failed=True) - self.fake_api.verification.rerun.assert_called_once_with("v_uuid", - "d_id", True) + self.verify.rerun(self.fake_api, "v_uuid", "d_id", failed=True,) + self.fake_api.verification.rerun.assert_called_once_with( + "v_uuid", deployment="d_id", failed=True, tags=None, concur=None) def test_show(self): deployment_name = "Some Deploy" diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py index 3d228afa0d..82f62b6a8c 100644 --- a/tests/unit/test_api.py +++ b/tests/unit/test_api.py @@ -1394,7 +1394,7 @@ class VerificationAPITestCase(test.TestCase): api._Verification.rerun("uuid") mock___verification_start.assert_called_once_with( - "v_uuid", "d_uuid", load_list=tests.keys()) + "v_uuid", "d_uuid", load_list=tests.keys(), tags=None) @mock.patch("rally.api._Verification.start") @mock.patch("rally.api._Deployment.get") @@ -1414,7 +1414,7 @@ class VerificationAPITestCase(test.TestCase): api._Verification.rerun("uuid", failed=True) expected_tests = [t for t, r in tests.items() if r["status"] == "fail"] mock___verification_start.assert_called_once_with( - "v_uuid", "d_uuid", load_list=expected_tests) + "v_uuid", "d_uuid", load_list=expected_tests, tags=None) @mock.patch("rally.api._Verification.get") def test_rerun_failed_tests_raise_exc(