diff options
Diffstat (limited to 'src/python/grpcio_test/grpc_interop')
-rw-r--r-- | src/python/grpcio_test/grpc_interop/client.py | 6 | ||||
-rw-r--r-- | src/python/grpcio_test/grpc_interop/resources.py | 9 | ||||
-rw-r--r-- | src/python/grpcio_test/grpc_interop/server.py | 4 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/python/grpcio_test/grpc_interop/client.py b/src/python/grpcio_test/grpc_interop/client.py index 36afe6c096..01928886b4 100644 --- a/src/python/grpcio_test/grpc_interop/client.py +++ b/src/python/grpcio_test/grpc_interop/client.py @@ -49,11 +49,11 @@ def _args(): parser.add_argument( '--test_case', help='the test case to execute', type=str) parser.add_argument( - '--use_tls', help='require a secure connection', dest='use_tls', - action='store_true') + '--use_tls', help='require a secure connection', default=False, + type=resources.parse_bool) parser.add_argument( '--use_test_ca', help='replace platform root CAs with ca.pem', - action='store_true') + default=False, type=resources.parse_bool) parser.add_argument( '--server_host_override', help='the server host to which to claim to connect', type=str) diff --git a/src/python/grpcio_test/grpc_interop/resources.py b/src/python/grpcio_test/grpc_interop/resources.py index 2c3045313d..1122499418 100644 --- a/src/python/grpcio_test/grpc_interop/resources.py +++ b/src/python/grpcio_test/grpc_interop/resources.py @@ -29,6 +29,7 @@ """Constants and functions for data used in interoperability testing.""" +import argparse import os import pkg_resources @@ -54,3 +55,11 @@ def private_key(): def certificate_chain(): return pkg_resources.resource_string( __name__, _CERTIFICATE_CHAIN_RESOURCE_PATH) + + +def parse_bool(value): + if value == 'true': + return True + if value == 'false': + return False + raise argparse.ArgumentTypeError('Only true/false allowed') diff --git a/src/python/grpcio_test/grpc_interop/server.py b/src/python/grpcio_test/grpc_interop/server.py index 60f630a6be..d4c1b4dbf6 100644 --- a/src/python/grpcio_test/grpc_interop/server.py +++ b/src/python/grpcio_test/grpc_interop/server.py @@ -46,8 +46,8 @@ def serve(): parser.add_argument( '--port', help='the port on which to serve', type=int) parser.add_argument( - '--use_tls', help='require a secure connection', dest='use_tls', - action='store_true') + '--use_tls', help='require a secure connection', + default=False, type=resources.parse_bool) args = parser.parse_args() if args.use_tls: |