diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-10-22 13:28:22 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-10-22 13:28:22 -0700 |
commit | beffc779bb1526c2177c19132415e60109c9e3da (patch) | |
tree | 2d940ae2235d3fae31a610ee68b2fdabf56e753a /src | |
parent | def77a5235b389af3e76fe7fc8699d70f426f957 (diff) |
stop using SSL_CERT_FILE env for C# interop tests
Diffstat (limited to 'src')
4 files changed, 11 insertions, 18 deletions
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 030a098cad..5eec11abf7 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -137,7 +137,11 @@ namespace Grpc.IntegrationTesting private async Task<ChannelCredentials> CreateCredentialsAsync() { - var credentials = options.UseTls.Value ? TestCredentials.CreateTestClientCredentials(options.UseTestCa.Value) : ChannelCredentials.Insecure; + var credentials = ChannelCredentials.Insecure; + if (options.UseTls.Value) + { + credentials = options.UseTestCa.Value ? TestCredentials.CreateSslCredentials() : new SslCredentials(); + } if (options.TestCase == "jwt_token_creds") { diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs index 7bc17a207f..837ae74c45 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs @@ -59,7 +59,7 @@ namespace Grpc.IntegrationTesting server = new Server { Services = { TestService.BindService(new TestServiceImpl()) }, - Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateTestServerCredentials() } } + Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } } }; server.Start(); @@ -68,7 +68,7 @@ namespace Grpc.IntegrationTesting new ChannelOption(ChannelOptions.SslTargetNameOverride, TestCredentials.DefaultHostOverride) }; int port = server.Ports.Single().BoundPort; - channel = new Channel(Host, port, TestCredentials.CreateTestClientCredentials(true), options); + channel = new Channel(Host, port, TestCredentials.CreateSslCredentials(), options); client = TestService.NewClient(channel); } diff --git a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs index 29f842be2e..cd47e31c2b 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs @@ -102,7 +102,7 @@ namespace Grpc.IntegrationTesting int port = options.Port; if (options.UseTls.Value) { - server.Ports.Add(host, port, TestCredentials.CreateTestServerCredentials()); + server.Ports.Add(host, port, TestCredentials.CreateSslServerCredentials()); } else { diff --git a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs index 7a48d6e92e..ce108d808b 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs @@ -51,26 +51,15 @@ namespace Grpc.IntegrationTesting public const string DefaultHostOverride = "foo.test.google.fr"; public const string ClientCertAuthorityPath = "data/ca.pem"; - public const string ClientCertAuthorityEnvName = "SSL_CERT_FILE"; - public const string ServerCertChainPath = "data/server1.pem"; public const string ServerPrivateKeyPath = "data/server1.key"; - public static SslCredentials CreateTestClientCredentials(bool useTestCa) + public static SslCredentials CreateSslCredentials() { - string caPath = ClientCertAuthorityPath; - if (!useTestCa) - { - caPath = Environment.GetEnvironmentVariable(ClientCertAuthorityEnvName); - if (string.IsNullOrEmpty(caPath)) - { - throw new ArgumentException("CA path environment variable is not set."); - } - } - return new SslCredentials(File.ReadAllText(caPath)); + return new SslCredentials(File.ReadAllText(ClientCertAuthorityPath)); } - public static SslServerCredentials CreateTestServerCredentials() + public static SslServerCredentials CreateSslServerCredentials() { var keyCertPair = new KeyCertificatePair( File.ReadAllText(ServerCertChainPath), |