Skip to content

Commit

Permalink
Remove ServicePointManager usage from acceptance tests since generall…
Browse files Browse the repository at this point in the history
…y .NET is moving away from ServicePointManager
  • Loading branch information
danielmarbach committed Mar 19, 2024
1 parent d854f29 commit 0fe1565
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 45 deletions.
@@ -1,7 +1,6 @@
namespace ServiceControl.AcceptanceTesting.EndpointTemplates
{
using System;
using System.Net;
using System.Threading.Tasks;
using AcceptanceTesting;
using NServiceBus;
Expand All @@ -19,8 +18,6 @@ protected DefaultServerBase() : this(new ConfigureEndpointLearningTransport())

public virtual async Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomizations, Func<EndpointConfiguration, Task> configurationBuilderCustomization)
{
ServicePointManager.DefaultConnectionLimit = 100;

var endpointConfiguration = new EndpointConfiguration(endpointCustomizations.EndpointName);

endpointConfiguration.Pipeline.Register(new StampDispatchBehavior(runDescriptor.ScenarioContext), "Stamps outgoing messages with session ID");
Expand Down
11 changes: 0 additions & 11 deletions src/ServiceControl.AcceptanceTests/TestSupport/AcceptanceTest.cs
Expand Up @@ -3,7 +3,6 @@ namespace ServiceControl.AcceptanceTests
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Threading;
Expand All @@ -20,18 +19,8 @@ namespace ServiceControl.AcceptanceTests
using TestSupport;

[TestFixture]
//[Parallelizable(ParallelScope.All)]
abstract class AcceptanceTest : NServiceBusAcceptanceTest, IAcceptanceTestInfrastructureProvider
{
protected AcceptanceTest()
{
ServicePointManager.DefaultConnectionLimit = int.MaxValue;
ServicePointManager.MaxServicePoints = int.MaxValue;
ServicePointManager.UseNagleAlgorithm = false; // Improvement for small tcp packets traffic, get buffered up to 1/2-second. If your storage communication is for small (less than ~1400 byte) payloads, this setting should help (especially when dealing with things like Azure Queues, which tend to have very small messages).
ServicePointManager.Expect100Continue = false; // This ensures tcp ports are free up quicker by the OS, prevents starvation of ports
ServicePointManager.SetTcpKeepAlive(true, 5000, 1000); // This is good for Azure because it reuses connections
}

public IDomainEvents DomainEvents => serviceControlRunnerBehavior.DomainEvents;
public HttpClient HttpClient => serviceControlRunnerBehavior.HttpClient;
public JsonSerializerOptions SerializerOptions => serviceControlRunnerBehavior.SerializerOptions;
Expand Down
10 changes: 0 additions & 10 deletions src/ServiceControl.Audit.AcceptanceTests/AcceptanceTest.cs
Expand Up @@ -4,7 +4,6 @@ namespace ServiceControl.Audit.AcceptanceTests
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
Expand All @@ -21,15 +20,6 @@ namespace ServiceControl.Audit.AcceptanceTests
[TestFixture]
abstract class AcceptanceTest : NServiceBusAcceptanceTest, IAcceptanceTestInfrastructureProvider
{
protected AcceptanceTest()
{
ServicePointManager.DefaultConnectionLimit = int.MaxValue;
ServicePointManager.MaxServicePoints = int.MaxValue;
ServicePointManager.UseNagleAlgorithm = false; // Improvement for small tcp packets traffic, get buffered up to 1/2-second. If your storage communication is for small (less than ~1400 byte) payloads, this setting should help (especially when dealing with things like Azure Queues, which tend to have very small messages).
ServicePointManager.Expect100Continue = false; // This ensures tcp ports are free up quicker by the OS, prevents starvation of ports
ServicePointManager.SetTcpKeepAlive(true, 5000, 1000); // This is good for Azure because it reuses connections
}

public HttpClient HttpClient => serviceControlRunnerBehavior.HttpClient;
public JsonSerializerOptions SerializerOptions => serviceControlRunnerBehavior.SerializerOptions;
protected IServiceProvider ServiceProvider => serviceControlRunnerBehavior.ServiceProvider;
Expand Down
11 changes: 0 additions & 11 deletions src/ServiceControl.Monitoring.AcceptanceTests/AcceptanceTest.cs
Expand Up @@ -3,7 +3,6 @@ namespace ServiceControl.Monitoring.AcceptanceTests
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using AcceptanceTesting;
Expand All @@ -18,16 +17,6 @@ namespace ServiceControl.Monitoring.AcceptanceTests
[TestFixture]
abstract class AcceptanceTest : NServiceBusAcceptanceTest, IAcceptanceTestInfrastructureProvider
{
protected AcceptanceTest()
{
ServicePointManager.DefaultConnectionLimit = int.MaxValue;
ServicePointManager.MaxServicePoints = int.MaxValue;
ServicePointManager.UseNagleAlgorithm = false; // Improvement for small tcp packets traffic, get buffered up to 1/2-second. If your storage communication is for small (less than ~1400 byte) payloads, this setting should help (especially when dealing with things like Azure Queues, which tend to have very small messages).
ServicePointManager.Expect100Continue = false; // This ensures tcp ports are free up quicker by the OS, prevents starvation of ports
ServicePointManager.SetTcpKeepAlive(true, 5000, 1000); // This is good for Azure because it reuses connections
}


public HttpClient HttpClient => serviceControlRunnerBehavior.HttpClient;
public JsonSerializerOptions SerializerOptions => serviceControlRunnerBehavior.SerializerOptions;

Expand Down
10 changes: 0 additions & 10 deletions src/ServiceControl.MultiInstance.AcceptanceTests/AcceptanceTest.cs
Expand Up @@ -4,7 +4,6 @@ namespace ServiceControl.MultiInstance.AcceptanceTests
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using AcceptanceTesting;
Expand All @@ -20,15 +19,6 @@ namespace ServiceControl.MultiInstance.AcceptanceTests
[TestFixture]
abstract class AcceptanceTest : NServiceBusAcceptanceTest, IAcceptanceTestInfrastructureProviderMultiInstance
{
protected AcceptanceTest()
{
ServicePointManager.DefaultConnectionLimit = int.MaxValue;
ServicePointManager.MaxServicePoints = int.MaxValue;
ServicePointManager.UseNagleAlgorithm = false; // Improvement for small tcp packets traffic, get buffered up to 1/2-second. If your storage communication is for small (less than ~1400 byte) payloads, this setting should help (especially when dealing with things like Azure Queues, which tend to have very small messages).
ServicePointManager.Expect100Continue = false; // This ensures tcp ports are free up quicker by the OS, prevents starvation of ports
ServicePointManager.SetTcpKeepAlive(true, 5000, 1000); // This is good for Azure because it reuses connections
}

protected static string ServiceControlInstanceName { get; } = Settings.DEFAULT_SERVICE_NAME;
protected static string ServiceControlAuditInstanceName { get; } = Audit.Infrastructure.Settings.Settings.DEFAULT_SERVICE_NAME;

Expand Down

0 comments on commit 0fe1565

Please sign in to comment.