aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-10-07 17:27:48 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-10-07 17:55:46 -0700
commit7828e813f780d95814db67fc2aac8a3e104ac743 (patch)
tree597412c5fd5d856cf2bcd2a9f226d7521435ebf9
parent706a010e3472951e45f34e31d34a16ab91a7b559 (diff)
make C# interop test args parsing compliant with spec
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClient.cs12
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropServer.cs7
-rwxr-xr-xtools/run_tests/run_interop_tests.py6
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 374dec1851..abc4b6e6fb 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'