Skip to content
Snippets Groups Projects
Commit 551d0f37 authored by Nathaniel Manista's avatar Nathaniel Manista
Browse files

Merge pull request #3860 from jtattermusch/python_use_tls_compat

Accept --use_tls=true and --use_test_ca=true in python interop tests.
parents 921149c4 785efd45
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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')
......@@ -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:
......
......@@ -275,17 +275,17 @@ class PythonLanguage:
def cloud_to_prod_args(self):
return (self.client_cmdline_base + _CLOUD_TO_PROD_BASE_ARGS +
['--use_tls'])
['--use_tls=true'])
def cloud_to_cloud_args(self):
return (self.client_cmdline_base + _CLOUD_TO_CLOUD_BASE_ARGS +
['--use_tls', '--use_test_ca'])
['--use_tls=true', '--use_test_ca=true'])
def cloud_to_prod_env(self):
return _SSL_CERT_ENV
def server_args(self):
return ['python2.7_virtual_environment/bin/python', '-m', 'grpc_interop.server', '--use_tls']
return ['python2.7_virtual_environment/bin/python', '-m', 'grpc_interop.server', '--use_tls=true']
def global_env(self):
return {'LD_LIBRARY_PATH': 'libs/opt'}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment