aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2015-10-16 15:12:55 -0700
committerGravatar Nathaniel Manista <nathaniel@google.com>2015-10-16 15:12:55 -0700
commit551d0f37cb933a3821eb096da4ac63cf6cb989a6 (patch)
tree2343d5ffdee147da9b00f1598028f7dd83dcabac /src/python
parent921149c43ac7b797ef69402411ea6d9064e303b5 (diff)
parent785efd453e1f391dda65660a62fa46b56bee89ef (diff)
Merge pull request #3860 from jtattermusch/python_use_tls_compat
Accept --use_tls=true and --use_test_ca=true in python interop tests.
Diffstat (limited to 'src/python')
-rw-r--r--src/python/grpcio_test/grpc_interop/client.py6
-rw-r--r--src/python/grpcio_test/grpc_interop/resources.py9
-rw-r--r--src/python/grpcio_test/grpc_interop/server.py4
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: