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..59dbb94 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; @@ -834,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) }; @@ -1071,6 +1080,10 @@ UInt16 GetPort(Int32 dockerPort) => case ContainerType.EstateManangementUI: EstateManagementUiPort = GetPort(DockerPorts.EstateManagementUIDockerPort); break; + case ContainerType.SqlServer: + SqlServerPort = GetPort(DockerPorts.SqlServerDockerPort); + break; + } }