Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Shared.IntegrationTesting/DockerPorts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
35 changes: 24 additions & 11 deletions Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
public virtual Dictionary<String,String> GetAdditionalVariables(ContainerType containerType){
Dictionary<String, String> result = new();

Dictionary<String, String>? additional = this.AdditionalVariables.SingleOrDefault(a => a.Key == containerType).Value;

Check warning on line 176 in Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
if (additional != null){
foreach (KeyValuePair<String, String> item in additional) {
result.Add(item.Key, item.Value);
Expand Down Expand Up @@ -211,8 +211,8 @@

public static async Task<SimpleResults.Result<DockerEnginePlatform>> GetDockerEnginePlatform(){
try{
DockerClient? docker = new DockerClientConfiguration().CreateClient();

Check warning on line 214 in Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
SystemInfoResponse? info = await docker.System.GetSystemInfoAsync();

Check warning on line 215 in Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

return info.OSType switch {
"linux" => Result.Success(DockerEnginePlatform.Linux),
Expand All @@ -228,15 +228,23 @@
public static DockerClient GetDockerHost() => new DockerClientConfiguration().CreateClient();


public Int32? GetHostPort(ContainerType key){
KeyValuePair<ContainerType, Int32> details = this.HostPorts.SingleOrDefault(c => c.Key == key);
if (details.Equals(default(KeyValuePair<ContainerType, Int32>))){
// 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<ContainerType, (String imageName, Boolean useLatest)> details = this.ImageDetails.SingleOrDefault(c => c.Key == key);
Expand Down Expand Up @@ -308,7 +316,8 @@
this.EstateManagementUiContainerName = $"estateadministrationui{this.TestId:N}";
}

public Int32 EstateManagementUiPort;
protected Int32 EstateManagementUiPort;
protected Int32 SqlServerPort;

protected String EstateManagementUiContainerName;

Expand Down Expand Up @@ -834,7 +843,7 @@
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)
};

Expand Down Expand Up @@ -912,7 +921,7 @@
try{
await projectionClient.CreateContinuousAsync(projectionName, projection, trackEmittedStreams:true).ConfigureAwait(false);
}
catch (Exception ex) {

Check warning on line 924 in Shared.IntegrationTesting/TestContainers/BaseDockerHelper.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests - Windows

The variable 'ex' is declared but never used
// ignored
}

Expand Down Expand Up @@ -1071,6 +1080,10 @@
case ContainerType.EstateManangementUI:
EstateManagementUiPort = GetPort(DockerPorts.EstateManagementUIDockerPort);
break;
case ContainerType.SqlServer:
SqlServerPort = GetPort(DockerPorts.SqlServerDockerPort);
break;

}
}

Expand Down
Loading