From 6f26804025031577f037b9aa3d0dd1e64cc6c42b Mon Sep 17 00:00:00 2001 From: Nathan Willoughby <86938706+nathanwoctopusdeploy@users.noreply.github.com> Date: Fri, 1 Dec 2023 14:22:16 +1000 Subject: [PATCH] Revert "Enable Halibut TCP Keep Alives by default (#706)" This reverts commit ac4a78426f92bbb7bdc532721b38246f9a46bfdb. --- .../TentacleCommunicationsModuleFixture.cs | 91 ------------------- .../TentacleCommunicationsModule.cs | 7 +- 2 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 source/Octopus.Tentacle.Tests/Communications/TentacleCommunicationsModuleFixture.cs diff --git a/source/Octopus.Tentacle.Tests/Communications/TentacleCommunicationsModuleFixture.cs b/source/Octopus.Tentacle.Tests/Communications/TentacleCommunicationsModuleFixture.cs deleted file mode 100644 index 270bd7f3d..000000000 --- a/source/Octopus.Tentacle.Tests/Communications/TentacleCommunicationsModuleFixture.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using Autofac; -using FluentAssertions; -using Halibut; -using NUnit.Framework; -using Octopus.Tentacle.Communications; -using Octopus.Tentacle.Configuration; -using Octopus.Tentacle.Tests.Commands; -using Octopus.Tentacle.Variables; - -namespace Octopus.Tentacle.Tests.Communications -{ - public class TentacleCommunicationsModuleFixture - { - [Test] - [NonParallelizable] - public void HalibutTcpKeepAlivesShouldBeEnabledByDefault() - { - var container = BuildContainer(); - - var halibutRuntime = container.Resolve(); - - halibutRuntime.TimeoutsAndLimits.TcpKeepAliveEnabled.Should().BeTrue(); - } - - [Test] - [NonParallelizable] - public void HalibutTcpKeepAlivesCanBeDisabledWithAnEnvironmentVariable() - { - try - { - Environment.SetEnvironmentVariable(EnvironmentVariables.TentacleTcpKeepAliveEnabled, "False"); - - var container = BuildContainer(); - - var halibutRuntime = container.Resolve(); - - halibutRuntime.TimeoutsAndLimits.TcpKeepAliveEnabled.Should().BeFalse(); - } - finally - { - Environment.SetEnvironmentVariable(EnvironmentVariables.TentacleTcpKeepAliveEnabled, ""); - } - } - - [Test] - [NonParallelizable] - public void AnEmptyHalibutTcpKeepAlivesEnvironmentVariableIsIgnored() - { - Environment.SetEnvironmentVariable(EnvironmentVariables.TentacleTcpKeepAliveEnabled, ""); - - var container = BuildContainer(); - - var halibutRuntime = container.Resolve(); - - halibutRuntime.TimeoutsAndLimits.TcpKeepAliveEnabled.Should().BeTrue(); - } - - [Test] - [NonParallelizable] - public void AnInvalidHalibutTcpKeepAlivesEnvironmentVariableIsIgnored() - { - try - { - Environment.SetEnvironmentVariable(EnvironmentVariables.TentacleTcpKeepAliveEnabled, "NOTABOOL"); - - var container = BuildContainer(); - - var halibutRuntime = container.Resolve(); - - halibutRuntime.TimeoutsAndLimits.TcpKeepAliveEnabled.Should().BeTrue(); - } - finally - { - Environment.SetEnvironmentVariable(EnvironmentVariables.TentacleTcpKeepAliveEnabled, ""); - } - } - - static IContainer BuildContainer() - { - var builder = new ContainerBuilder(); - var configuration = new StubTentacleConfiguration(); - configuration.TentacleCertificate = configuration.GenerateNewCertificate(); - configuration.AddOrUpdateTrustedOctopusServer(new OctopusServerConfiguration("NOPE")); - builder.RegisterInstance(configuration).As(); - builder.RegisterModule(); - var container = builder.Build(); - return container; - } - } -} \ No newline at end of file diff --git a/source/Octopus.Tentacle/Communications/TentacleCommunicationsModule.cs b/source/Octopus.Tentacle/Communications/TentacleCommunicationsModule.cs index 95e34c10a..1b3c3f114 100644 --- a/source/Octopus.Tentacle/Communications/TentacleCommunicationsModule.cs +++ b/source/Octopus.Tentacle/Communications/TentacleCommunicationsModule.cs @@ -25,12 +25,7 @@ protected override void Load(ContainerBuilder builder) var configuration = c.Resolve(); var services = c.Resolve(); - if (!bool.TryParse(Environment.GetEnvironmentVariable(EnvironmentVariables.TentacleTcpKeepAliveEnabled), out var tcpKeepAliveEnabled)) - { - // Default to enabled if the environment variable is not provided - tcpKeepAliveEnabled = true; - } - + bool.TryParse(Environment.GetEnvironmentVariable(EnvironmentVariables.TentacleTcpKeepAliveEnabled), out var tcpKeepAliveEnabled); bool.TryParse(Environment.GetEnvironmentVariable(EnvironmentVariables.TentacleUseRecommendedTimeoutsAndLimits), out var useRecommendedTimeoutsAndLimits); var halibutTimeoutsAndLimits = useRecommendedTimeoutsAndLimits