From 7e60a7730dcdcdee95ac193ab2c5bcc89a14a578 Mon Sep 17 00:00:00 2001 From: Anand Shanmugam Date: Thu, 28 Apr 2016 13:55:00 -0700 Subject: [PATCH] Adding options to call all-tests from cli Change-Id: I3bdc546d67233ac982758ae6d1f1df42a6d1ed65 --- cloudpulseclient/v1/shell.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/cloudpulseclient/v1/shell.py b/cloudpulseclient/v1/shell.py index 2249bc3..2806a1a 100644 --- a/cloudpulseclient/v1/shell.py +++ b/cloudpulseclient/v1/shell.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from cloudpulseclient import exceptions from cloudpulseclient.openstack.common import cliutils as utils @@ -41,13 +42,34 @@ def do_result(cs, args): sortby_index=1) -@utils.arg('name', +@utils.arg('--name', metavar='', help='Name of the healthcheck to run') +@utils.arg('--all-tests', + metavar='', + action='store_const', + const='all_tests', + help="Run all tests") +@utils.arg('--all-endpoint-tests', + metavar='', + action='store_const', + const='all_endpoint_tests', + help="Run all endpoint tests") +@utils.arg('--all-operator-tests', + metavar='', + action='store_const', + const='all_operator_tests', + help="Run all endpoint tests") def do_run(cs, args): """Run new test""" + if not any([args.name, args.all_operator_tests, + args.all_tests, args.all_endpoint_tests]): + raise exceptions.CommandError( + ("Usage: cloudpulse --name ." + "See 'cloudpulse help run' for details")) opts = {} - opts['name'] = args.name + opts['name'] = args.name or args.all_operator_tests or \ + args.all_tests or args.all_endpoint_tests healtcheck = cs.healthcheck.create(**opts) utils.print_dict(healtcheck._info)