diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 0df4ee35ba9..0ed2910ae02 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 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 513f8722d64..29f842be2ec 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 374dec1851c..abc4b6e6fb7 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'