From d799fc3988341c846bea5216fb2dc188321d9b77 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Mon, 2 Feb 2026 11:57:40 +0000 Subject: [PATCH 1/2] Add SqlServer Docker container support and port mapping Introduce support for a SqlServer Docker container by adding a dedicated port constant and updating BaseDockerHelper to track and expose the SqlServer port. Refactor GetHostPort to use a switch expression for clearer port retrieval, and update port assignment logic to handle the new container type. Also, change EstateManagementUiPort to protected for better encapsulation. These changes improve test infrastructure flexibility and maintainability. --- Shared.IntegrationTesting/DockerPorts.cs | 1 + .../TestContainers/BaseDockerHelper.cs | 33 +++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Shared.IntegrationTesting/DockerPorts.cs b/Shared.IntegrationTesting/DockerPorts.cs index 96da092..d713041 100644 --- a/Shared.IntegrationTesting/DockerPorts.cs +++ b/Shared.IntegrationTesting/DockerPorts.cs @@ -24,4 +24,5 @@ public static class DockerPorts public static readonly Int32 ConfigHostDockerPort = 9200; public static readonly Int32 EstateManagementUIDockerPort = 5004; + public static readonly Int32 SqlServerDockerPort = 1433; } \ No newline at end of file diff --git a/Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs b/Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs index 538c8a5..40ef46c 100644 --- a/Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs +++ b/Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs @@ -228,15 +228,23 @@ public virtual Dictionary GetCommonEnvironmentVariables(){ public static DockerClient GetDockerHost() => new DockerClientConfiguration().CreateClient(); - public Int32? GetHostPort(ContainerType key){ - KeyValuePair details = this.HostPorts.SingleOrDefault(c => c.Key == key); - if (details.Equals(default(KeyValuePair))){ - // No details found so return a null - return null; - } - - return details.Value; - } + public Int32? GetHostPort(ContainerType key) => + key switch { + ContainerType.CallbackHandler => this.CallbackHandlerPort, + //ContainerType.EventStore => this.EventStoreHttpPort, + ContainerType.ConfigurationHost => this.ConfigHostPort, + ContainerType.FileProcessor => this.FileProcessorPort, + ContainerType.MessagingService => this.MessagingServicePort, + ContainerType.SecurityService => this.SecurityServicePort, + ContainerType.TestHost => this.TestHostServicePort, + ContainerType.TransactionProcessor => this.TransactionProcessorPort, + ContainerType.TransactionProcessorAcl => this.TransactionProcessorAclPort, + ContainerType.SqlServer => this.SqlServerPort, + ContainerType.EstateManangementUI => this.EstateManagementUiPort, + _ when key == ContainerType.EventStore && this.IsSecureEventStore => this.EventStoreSecureHttpPort, + _ when key == ContainerType.EventStore && this.IsSecureEventStore == false => this.EventStoreHttpPort, + _ => null + }; public SimpleResults.Result<(String imageName, Boolean useLatest)> GetImageDetails(ContainerType key){ KeyValuePair details = this.ImageDetails.SingleOrDefault(c => c.Key == key); @@ -308,7 +316,8 @@ public virtual void SetupContainerNames(){ this.EstateManagementUiContainerName = $"estateadministrationui{this.TestId:N}"; } - public Int32 EstateManagementUiPort; + protected Int32 EstateManagementUiPort; + protected Int32 SqlServerPort; protected String EstateManagementUiContainerName; @@ -1071,6 +1080,10 @@ UInt16 GetPort(Int32 dockerPort) => case ContainerType.EstateManangementUI: EstateManagementUiPort = GetPort(DockerPorts.EstateManagementUIDockerPort); break; + case ContainerType.SqlServer: + SqlServerPort = GetPort(DockerPorts.SqlServerDockerPort); + break; + } } From dcabc9393404597c1571e0c9eb74005f42e6bda7 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Mon, 2 Feb 2026 12:50:58 +0000 Subject: [PATCH 2/2] remove estate ui health check atm --- Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs b/Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs index 40ef46c..59dbb94 100644 --- a/Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs +++ b/Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs @@ -843,7 +843,7 @@ protected async Task DoHealthCheck(ContainerType containerType) { ContainerType.SecurityService => ("https", this.SecurityServicePort), ContainerType.TransactionProcessorAcl => ("http", this.TransactionProcessorAclPort), //ContainerType.ConfigurationHost => ("http", this.ConfigHostPort), - ContainerType.EstateManangementUI => ("https", this.EstateManagementUiPort), + //ContainerType.EstateManangementUI => ("https", this.EstateManagementUiPort), _ => (null, 0) };