aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2017-04-21 11:45:35 +0200
committerGravatar GitHub <noreply@github.com>2017-04-21 11:45:35 +0200
commit393d33c1a952549f1e1c8e63adb250458e6e8e7f (patch)
tree11a221a644dda2bb85ef8a4643d61e6658a4597b /src
parent7ef27a88b3dd3d9fa3c927722588793f82b82c96 (diff)
parent09d2f55c34e9a969a180e34c83774c936c2bc5de (diff)
Merge pull request #10756 from jtattermusch/csharp_prevent_reuseport
Eliminate crosstalk between C# tests
Diffstat (limited to 'src')
-rw-r--r--src/csharp/Grpc.Core.Tests/MockServiceHelper.cs3
-rw-r--r--src/csharp/Grpc.Core/ChannelOptions.cs3
-rw-r--r--src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs3
-rw-r--r--src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs3
-rw-r--r--src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs3
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs3
-rw-r--r--src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs3
-rw-r--r--src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs3
-rw-r--r--src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs3
9 files changed, 19 insertions, 8 deletions
diff --git a/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs b/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs
index 4d90470056..c57c260c96 100644
--- a/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs
+++ b/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs
@@ -141,7 +141,8 @@ namespace Grpc.Core.Tests
{
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 },
Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }
diff --git a/src/csharp/Grpc.Core/ChannelOptions.cs b/src/csharp/Grpc.Core/ChannelOptions.cs
index 46a2c6695f..5de9b1ee3c 100644
--- a/src/csharp/Grpc.Core/ChannelOptions.cs
+++ b/src/csharp/Grpc.Core/ChannelOptions.cs
@@ -172,6 +172,9 @@ namespace Grpc.Core
/// <summary>Secondary user agent: goes at the end of the user-agent metadata</summary>
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>
/// Creates native object for a collection of channel options.
/// </summary>
diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
index 50dacc2eaa..02bcd18cb5 100644
--- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
+++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
@@ -55,7 +55,8 @@ namespace Math.Tests
[TestFixtureSetUp]
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()) },
Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }
diff --git a/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs b/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
index 25a58fb386..0ebc3c3370 100644
--- a/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
+++ b/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
@@ -57,7 +57,8 @@ namespace Grpc.HealthCheck.Tests
{
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) },
Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }
diff --git a/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs b/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs
index 4216dc1d6b..780a9b7304 100644
--- a/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs
@@ -54,7 +54,8 @@ namespace Grpc.IntegrationTesting
[SetUp]
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()) },
Ports = { { Host, ServerPort.PickUnused, SslServerCredentials.Insecure } }
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
index 4960a53f92..04f833fcf5 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
@@ -56,7 +56,8 @@ namespace Grpc.IntegrationTesting
[TestFixtureSetUp]
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()) },
Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } }
diff --git a/src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs b/src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs
index d55e658d94..ef63f530f6 100644
--- a/src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs
@@ -56,7 +56,8 @@ namespace Grpc.IntegrationTesting
[SetUp]
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()) },
Ports = { { Host, ServerPort.PickUnused, TestCredentials.CreateSslServerCredentials() } }
diff --git a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
index 377dad63f4..48ecc2344f 100644
--- a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
@@ -67,7 +67,8 @@ namespace Grpc.IntegrationTesting
var serverCredentials = new SslServerCredentials(new[] { keyCertPair }, rootCert, true);
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()) },
Ports = { { Host, ServerPort.PickUnused, serverCredentials } }
diff --git a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs
index 1d0845e276..22edbed040 100644
--- a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs
+++ b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs
@@ -58,7 +58,8 @@ namespace Grpc.Reflection.Tests
{
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) },
Ports = { { Host, ServerPort.PickUnused, ServerCredentials.Insecure } }