diff options
author | Adele Zhou <adelez@google.com> | 2017-01-17 14:18:41 -0800 |
---|---|---|
committer | Adele Zhou <adelez@google.com> | 2017-01-17 16:55:58 -0800 |
commit | 57b02fcaba2162631d787b4349b42146efdc45ab (patch) | |
tree | f2985333bcb5f7dd7b1e7a8e80ca0128acbc2a06 /tools | |
parent | c0d7d67dfbe4f7d539e64365c4111b748285668f (diff) |
merge
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/run_tests/run_interop_tests.py | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 56efac50ca..b2dac7d1a8 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -86,7 +86,7 @@ class CXXLanguage: return {} def server_cmd(self, args): - return ['bins/opt/interop_server', '--use_tls=true'] + args + return ['bins/opt/interop_server'] + args def global_env(self): return {} @@ -115,7 +115,7 @@ class CSharpLanguage: return {} def server_cmd(self, args): - return ['mono', 'Grpc.IntegrationTesting.Server.exe', '--use_tls=true'] + args + return ['mono', 'Grpc.IntegrationTesting.Server.exe'] + args def global_env(self): return {} @@ -144,7 +144,7 @@ class CSharpCoreCLRLanguage: return {} def server_cmd(self, args): - return ['dotnet', 'exec', 'Grpc.IntegrationTesting.Server.dll', '--use_tls=true'] + args + return ['dotnet', 'exec', 'Grpc.IntegrationTesting.Server.dll'] + args def global_env(self): return {} @@ -176,7 +176,7 @@ class JavaLanguage: return {} def server_cmd(self, args): - return ['./run-test-server.sh', '--use_tls=true'] + args + return ['./run-test-server.sh'] + args def global_env(self): return {} @@ -206,7 +206,7 @@ class GoLanguage: return {} def server_cmd(self, args): - return ['go', 'run', 'server.go', '--use_tls=true'] + args + return ['go', 'run', 'server.go'] + args def global_env(self): return {} @@ -292,8 +292,7 @@ class NodeLanguage: def server_cmd(self, args): return ['tools/run_tests/interop/with_nvm.sh', - 'node', 'src/node/interop/interop_server.js', - '--use_tls=true'] + args + 'node', 'src/node/interop/interop_server.js'] + args def global_env(self): return {} @@ -374,7 +373,7 @@ class RubyLanguage: def server_cmd(self, args): return ['tools/run_tests/interop/with_rvm.sh', - 'ruby', 'src/ruby/pb/test/server.rb', '--use_tls=true'] + args + 'ruby', 'src/ruby/pb/test/server.rb'] + args def global_env(self): return {} @@ -419,7 +418,7 @@ class PythonLanguage: 'src/python/grpcio_tests/setup.py', 'run_interop', '--server', - '--args="{}"'.format(' '.join(args) + ' --use_tls=true') + '--args="{}"'.format(' '.join(args)) ] def global_env(self): @@ -586,11 +585,11 @@ def cloud_to_prod_jobspec(language, test_case, server_host_name, def cloud_to_cloud_jobspec(language, test_case, server_name, server_host, - server_port, docker_image=None): + server_port, docker_image=None, insecure=False): """Creates jobspec for cloud-to-cloud interop test""" interop_only_options = [ '--server_host_override=foo.test.google.fr', - '--use_tls=true', + '--use_tls=%s' % ('false' if insecure else 'true'), '--use_test_ca=true', ] common_options = [ @@ -634,11 +633,12 @@ def cloud_to_cloud_jobspec(language, test_case, server_name, server_host, return test_job -def server_jobspec(language, docker_image): +def server_jobspec(language, docker_image, insecure=False): """Create jobspec for running a server""" container_name = dockerjob.random_name('interop_server_%s' % language.safename) cmdline = bash_cmdline( - language.server_cmd(['--port=%s' % _DEFAULT_SERVER_PORT])) + language.server_cmd(['--port=%s' % _DEFAULT_SERVER_PORT, + '--use_tls=%s' % ('false' if insecure else 'true')])) environ = language.global_env() if language.safename == 'http2': # we are running the http2 interop server. Open next N ports beginning @@ -803,6 +803,11 @@ argp.add_argument('--http2_badserver_interop', action='store_const', const=True, help='Enable HTTP/2 server edge case testing. (Good client, bad server)') +argp.add_argument('--insecure', + default=False, + action='store_const', + const=True, + help='Whether to use secure channel.') args = argp.parse_args() @@ -868,7 +873,8 @@ server_addresses={} try: for s in servers: lang = str(s) - spec = server_jobspec(_LANGUAGES[lang], docker_images.get(lang)) + spec = server_jobspec(_LANGUAGES[lang], docker_images.get(lang), + args.insecure) job = dockerjob.DockerJob(spec) server_jobs[lang] = job server_addresses[lang] = ('localhost', job.mapped_port(_DEFAULT_SERVER_PORT)) @@ -883,6 +889,8 @@ try: jobs = [] if args.cloud_to_prod: + if args.insecure: + print('TLS is always enabled for cloud_to_prod scenarios.') for server_host_name in args.prod_servers: for language in languages: for test_case in _TEST_CASES: @@ -903,6 +911,8 @@ try: jobs.append(test_job) if args.cloud_to_prod_auth: + if args.insecure: + print('TLS is always enabled for cloud_to_prod scenarios.') for server_host_name in args.prod_servers: for language in languages: for test_case in _AUTH_TEST_CASES: @@ -934,7 +944,8 @@ try: server_name, server_host, server_port, - docker_image=docker_images.get(str(language))) + docker_image=docker_images.get(str(language)), + insecure=args.insecure) jobs.append(test_job) if args.http2_interop: @@ -947,7 +958,8 @@ try: server_name, server_host, server_port, - docker_image=docker_images.get(str(http2Interop))) + docker_image=docker_images.get(str(http2Interop)), + insecure=args.insecure) jobs.append(test_job) if args.http2_badserver_interop: |