diff options
author | Michael Lumish <mlumish@google.com> | 2015-10-07 20:17:11 -0700 |
---|---|---|
committer | Michael Lumish <mlumish@google.com> | 2015-10-07 20:17:11 -0700 |
commit | 071252799926f9a87fd450d0396b5a1ed1db3c9b (patch) | |
tree | c978514d0575e63a6f4664d9c19f7063f8252a70 | |
parent | ad6b4bb81aaefd673b36e29b3d50c6eb436e41e4 (diff) | |
parent | 7828e813f780d95814db67fc2aac8a3e104ac743 (diff) |
Merge pull request #3729 from jtattermusch/csharp_args_spec
Make C# interop tests args parsing compliant with spec.
-rw-r--r-- | src/csharp/Grpc.IntegrationTesting/InteropClient.cs | 12 | ||||
-rw-r--r-- | src/csharp/Grpc.IntegrationTesting/InteropServer.cs | 7 | ||||
-rwxr-xr-x | tools/run_tests/run_interop_tests.py | 6 |
3 files changed, 14 insertions, 11 deletions
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 0df4ee35ba..0ed2910ae0 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -66,11 +66,13 @@ namespace Grpc.IntegrationTesting [Option("test_case", DefaultValue = "large_unary")] public string TestCase { get; set; } - [Option("use_tls")] - public bool UseTls { get; set; } + // Deliberately using nullable bool type to allow --use_tls=true syntax (as opposed to --use_tls) + [Option("use_tls", DefaultValue = false)] + public bool? UseTls { get; set; } - [Option("use_test_ca")] - public bool UseTestCa { get; set; } + // Deliberately using nullable bool type to allow --use_test_ca=true syntax (as opposed to --use_test_ca) + [Option("use_test_ca", DefaultValue = false)] + public bool? UseTestCa { get; set; } [Option("default_service_account", Required = false)] public string DefaultServiceAccount { get; set; } @@ -134,7 +136,7 @@ namespace Grpc.IntegrationTesting private async Task<ChannelCredentials> CreateCredentialsAsync() { - var credentials = options.UseTls ? TestCredentials.CreateTestClientCredentials(options.UseTestCa) : ChannelCredentials.Insecure; + var credentials = options.UseTls.Value ? TestCredentials.CreateTestClientCredentials(options.UseTestCa.Value) : ChannelCredentials.Insecure; if (options.TestCase == "jwt_token_creds") { diff --git a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs index 513f8722d6..29f842be2e 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs @@ -54,8 +54,9 @@ namespace Grpc.IntegrationTesting [Option("port", DefaultValue = 8070)] public int Port { get; set; } - [Option("use_tls")] - public bool UseTls { get; set; } + // Deliberately using nullable bool type to allow --use_tls=true syntax (as opposed to --use_tls) + [Option("use_tls", DefaultValue = false)] + public bool? UseTls { get; set; } [HelpOption] public string GetUsage() @@ -99,7 +100,7 @@ namespace Grpc.IntegrationTesting string host = "0.0.0.0"; int port = options.Port; - if (options.UseTls) + if (options.UseTls.Value) { server.Ports.Add(host, port, TestCredentials.CreateTestServerCredentials()); } diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 48c34f6871..45efa572f9 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -100,17 +100,17 @@ class CSharpLanguage: 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 ['mono', 'Grpc.IntegrationTesting.Server.exe', '--use_tls'] + return ['mono', 'Grpc.IntegrationTesting.Server.exe', '--use_tls=true'] def __str__(self): return 'csharp' |