make C# interop test args parsing compliant with spec

pull/3729/head
Jan Tattermusch 10 years ago
parent 706a010e34
commit 7828e813f7
  1. 12
      src/csharp/Grpc.IntegrationTesting/InteropClient.cs
  2. 7
      src/csharp/Grpc.IntegrationTesting/InteropServer.cs
  3. 6
      tools/run_tests/run_interop_tests.py

@ -66,11 +66,13 @@ namespace Grpc.IntegrationTesting
[Option("test_case", DefaultValue = "large_unary")] [Option("test_case", DefaultValue = "large_unary")]
public string TestCase { get; set; } public string TestCase { get; set; }
[Option("use_tls")] // Deliberately using nullable bool type to allow --use_tls=true syntax (as opposed to --use_tls)
public bool UseTls { get; set; } [Option("use_tls", DefaultValue = false)]
public bool? UseTls { get; set; }
[Option("use_test_ca")] // Deliberately using nullable bool type to allow --use_test_ca=true syntax (as opposed to --use_test_ca)
public bool UseTestCa { get; set; } [Option("use_test_ca", DefaultValue = false)]
public bool? UseTestCa { get; set; }
[Option("default_service_account", Required = false)] [Option("default_service_account", Required = false)]
public string DefaultServiceAccount { get; set; } public string DefaultServiceAccount { get; set; }
@ -134,7 +136,7 @@ namespace Grpc.IntegrationTesting
private async Task<ChannelCredentials> CreateCredentialsAsync() 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") if (options.TestCase == "jwt_token_creds")
{ {

@ -54,8 +54,9 @@ namespace Grpc.IntegrationTesting
[Option("port", DefaultValue = 8070)] [Option("port", DefaultValue = 8070)]
public int Port { get; set; } public int Port { get; set; }
[Option("use_tls")] // Deliberately using nullable bool type to allow --use_tls=true syntax (as opposed to --use_tls)
public bool UseTls { get; set; } [Option("use_tls", DefaultValue = false)]
public bool? UseTls { get; set; }
[HelpOption] [HelpOption]
public string GetUsage() public string GetUsage()
@ -99,7 +100,7 @@ namespace Grpc.IntegrationTesting
string host = "0.0.0.0"; string host = "0.0.0.0";
int port = options.Port; int port = options.Port;
if (options.UseTls) if (options.UseTls.Value)
{ {
server.Ports.Add(host, port, TestCredentials.CreateTestServerCredentials()); server.Ports.Add(host, port, TestCredentials.CreateTestServerCredentials());
} }

@ -100,17 +100,17 @@ class CSharpLanguage:
def cloud_to_prod_args(self): def cloud_to_prod_args(self):
return (self.client_cmdline_base + _CLOUD_TO_PROD_BASE_ARGS + return (self.client_cmdline_base + _CLOUD_TO_PROD_BASE_ARGS +
['--use_tls']) ['--use_tls=true'])
def cloud_to_cloud_args(self): def cloud_to_cloud_args(self):
return (self.client_cmdline_base + _CLOUD_TO_CLOUD_BASE_ARGS + 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): def cloud_to_prod_env(self):
return _SSL_CERT_ENV return _SSL_CERT_ENV
def server_args(self): def server_args(self):
return ['mono', 'Grpc.IntegrationTesting.Server.exe', '--use_tls'] return ['mono', 'Grpc.IntegrationTesting.Server.exe', '--use_tls=true']
def __str__(self): def __str__(self):
return 'csharp' return 'csharp'

Loading…
Cancel
Save