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
4 changes: 2 additions & 2 deletions TransactionProcessorACL.IntegrationTests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM.

[assembly: Guid("25d4d6fc-b809-4acc-a910-249a03e5f07a")]
[assembly: LevelOfParallelism(2)]
[assembly: Parallelizable(ParallelScope.Fixtures)]
[assembly: LevelOfParallelism(3)]
[assembly: Parallelizable(ParallelScope.Fixtures)]
55 changes: 54 additions & 1 deletion TransactionProcessorACL.IntegrationTests/Common/DockerHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using EventStore.Client;
using Shared.IntegrationTesting;
using System.Linq;
using DotNet.Testcontainers.Builders;

namespace TransactionProcessor.IntegrationTests.Common
{
Expand All @@ -9,6 +10,7 @@ namespace TransactionProcessor.IntegrationTests.Common
using Shared.Serialisation;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -57,6 +59,7 @@ public class DockerHelper : global::Shared.IntegrationTesting.TestContainers.Doc
/// <param name="logger">The logger.</param>
public DockerHelper()
{
this.IsSecureEventStore = false;
this.TestingContext = new TestingContext();
StringSerialiser.Initialise((IStringSerialiser)new SystemTextJsonSerializer(SystemTextJsonSerializer.GetDefaultJsonSerializerOptions()));
}
Expand All @@ -74,6 +77,16 @@ public override DotNet.Testcontainers.Builders.ContainerBuilder SetupEstateRepor
return base.SetupEstateReportingContainer();
}

public override ContainerBuilder SetupTransactionProcessorContainer()
{
Dictionary<String, String> additionalVariables = new();
additionalVariables.Add("OperatorConfiguration:AgencyBanking:Url", $"http://{this.TestHostContainerName}:{DockerPorts.TestHostPort}/api/agencybanking");

this.AdditionalVariables.Add(ContainerType.TransactionProcessor, additionalVariables);

return base.SetupTransactionProcessorContainer();
}

public override async Task CreateSubscriptions(){
List<(String streamName, String groupName, Int32 maxRetries)> subscriptions = new List<(String streamName, String groupName, Int32 maxRetries)>();
subscriptions.AddRange(MessagingService.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions());
Expand All @@ -93,7 +106,15 @@ public override async Task CreateSubscriptions(){
/// <param name="scenarioName">Name of the scenario.</param>
public override async Task StartContainersForScenarioRun(String scenarioName, DockerServices dockerServices)
{
await base.StartContainersForScenarioRun(scenarioName, dockerServices);
try
{
await base.StartContainersForScenarioRun(scenarioName, dockerServices);
}
catch
{
this.DumpDockerContainerState();
throw;
}

// Setup the base address resolvers
String SecurityServiceBaseAddressResolver(String api) => $"https://127.0.0.1:{this.SecurityServicePort}";
Expand Down Expand Up @@ -127,6 +148,38 @@ public override async Task StartContainersForScenarioRun(String scenarioName, Do

}

private void DumpDockerContainerState()
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "docker",
Arguments = "ps -a --no-trunc --format \"table {{.ID}}\\t{{.Names}}\\t{{.Status}}\\t{{.Image}}\\t{{.Ports}}\"",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
};

using Process process = Process.Start(startInfo);
if (process == null)
{
Console.WriteLine("Unable to start docker diagnostics process.");
return;
}

String output = process.StandardOutput.ReadToEnd();
String error = process.StandardError.ReadToEnd();
process.WaitForExit();

Console.WriteLine("Docker containers at container startup failure:");
Console.WriteLine(output);
if (String.IsNullOrWhiteSpace(error) == false)
{
Console.WriteLine("Docker diagnostics error:");
Console.WriteLine(error);
}
}

String Serialise(Object arg)
{
return StringSerialiser.Serialise<Object>(arg, new SerialiserOptions(SerialiserPropertyFormat.SnakeCase));
Expand Down
2 changes: 1 addition & 1 deletion TransactionProcessorACL.IntegrationTests/Common/Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Setup

public static async Task GlobalSetup(DockerHelper dockerHelper)
{
ShouldlyConfiguration.DefaultTaskTimeout = TimeSpan.FromMinutes(1);
ShouldlyConfiguration.DefaultTaskTimeout = TimeSpan.FromMinutes(5);
}
}
}
Loading
Loading