Merge pull request #10756 from jtattermusch/csharp_prevent_reuseport

Eliminate crosstalk between C# tests
pull/10765/merge
Jan Tattermusch 8 years ago committed by GitHub
commit 393d33c1a9
  1. 3
      src/csharp/Grpc.Core.Tests/MockServiceHelper.cs
  2. 3
      src/csharp/Grpc.Core/ChannelOptions.cs
  3. 3
      src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
  4. 3
      src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
  5. 3
      src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs
  6. 3
      src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
  7. 3
      src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs
  8. 3
      src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
  9. 3
      src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs

@ -141,7 +141,8 @@ namespace Grpc.Core.Tests
{ {
if (server == null) if (server == null)
{ {
server = new Server // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
{ {
Services = { serviceDefinition }, Services = { serviceDefinition },
Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } } Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }

@ -172,6 +172,9 @@ namespace Grpc.Core
/// <summary>Secondary user agent: goes at the end of the user-agent metadata</summary> /// <summary>Secondary user agent: goes at the end of the user-agent metadata</summary>
public const string SecondaryUserAgentString = "grpc.secondary_user_agent"; public const string SecondaryUserAgentString = "grpc.secondary_user_agent";
/// <summary>If non-zero, allow the use of SO_REUSEPORT for server if it's available (default 1)</summary>
public const string SoReuseport = "grpc.so_reuseport";
/// <summary> /// <summary>
/// Creates native object for a collection of channel options. /// Creates native object for a collection of channel options.
/// </summary> /// </summary>

@ -55,7 +55,8 @@ namespace Math.Tests
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init()
{ {
server = new Server // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
{ {
Services = { Math.BindService(new MathServiceImpl()) }, Services = { Math.BindService(new MathServiceImpl()) },
Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } } Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }

@ -57,7 +57,8 @@ namespace Grpc.HealthCheck.Tests
{ {
serviceImpl = new HealthServiceImpl(); serviceImpl = new HealthServiceImpl();
server = new Server // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
{ {
Services = { Grpc.Health.V1.Health.BindService(serviceImpl) }, Services = { Grpc.Health.V1.Health.BindService(serviceImpl) },
Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } } Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }

@ -54,7 +54,8 @@ namespace Grpc.IntegrationTesting
[SetUp] [SetUp]
public void Init() public void Init()
{ {
server = new Server // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
{ {
Services = { TestService.BindService(new UnimplementedTestServiceImpl()) }, Services = { TestService.BindService(new UnimplementedTestServiceImpl()) },
Ports = { { Host, ServerPort.PickUnused, SslServerCredentials.Insecure } } Ports = { { Host, ServerPort.PickUnused, SslServerCredentials.Insecure } }

@ -56,7 +56,8 @@ namespace Grpc.IntegrationTesting
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init()
{ {
server = new Server // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
{ {
Services = { TestService.BindService(new TestServiceImpl()) }, Services = { TestService.BindService(new TestServiceImpl()) },
Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } } Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } }

@ -56,7 +56,8 @@ namespace Grpc.IntegrationTesting
[SetUp] [SetUp]
public void Init() public void Init()
{ {
server = new Server // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
{ {
Services = { TestService.BindService(new FakeTestService()) }, Services = { TestService.BindService(new FakeTestService()) },
Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } } Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } }

@ -67,7 +67,8 @@ namespace Grpc.IntegrationTesting
var serverCredentials = new SslServerCredentials(new[] { keyCertPair }, rootCert, true); var serverCredentials = new SslServerCredentials(new[] { keyCertPair }, rootCert, true);
var clientCredentials = new SslCredentials(rootCert, keyCertPair); var clientCredentials = new SslCredentials(rootCert, keyCertPair);
server = new Server // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
{ {
Services = { TestService.BindService(new SslCredentialsTestServiceImpl()) }, Services = { TestService.BindService(new SslCredentialsTestServiceImpl()) },
Ports = { { Host, ServerPort.PickUnused, serverCredentials } } Ports = { { Host, ServerPort.PickUnused, serverCredentials } }

@ -58,7 +58,8 @@ namespace Grpc.Reflection.Tests
{ {
serviceImpl = new ReflectionServiceImpl(ServerReflection.Descriptor); serviceImpl = new ReflectionServiceImpl(ServerReflection.Descriptor);
server = new Server // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) })
{ {
Services = { ServerReflection.BindService(serviceImpl) }, Services = { ServerReflection.BindService(serviceImpl) },
Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } } Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }

Loading…
Cancel
Save