From 64c27b2d9e880c1e1c5d936c4a68d74d508b5d11 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 20 Dec 2019 11:28:26 +0000 Subject: [PATCH 01/22] Update nightly schedule --- .github/workflows/nightlybuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightlybuild.yml b/.github/workflows/nightlybuild.yml index 24b2193d..125f1da2 100644 --- a/.github/workflows/nightlybuild.yml +++ b/.github/workflows/nightlybuild.yml @@ -2,7 +2,7 @@ name: Nightly Build on: schedule: - - cron: "* 23 * * *" + - cron: "10 23 * * *" jobs: build: @@ -51,4 +51,4 @@ jobs: run: docker build . --file TransactionProcessor/Dockerfile --tag transactionprocessor:latest - name: Run Integration Tests - run: dotnet test "TransactionProcessor.IntegrationTests\TransactionProcessor.IntegrationTests.csproj" \ No newline at end of file + run: dotnet test "TransactionProcessor.IntegrationTests\TransactionProcessor.IntegrationTests.csproj" From 4d5cef078ad0906770282b19035d275a24117f38 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 11:48:10 +0000 Subject: [PATCH 02/22] Add debugging --- .../Common/DockerHelper.cs | 4 ++-- .../Common/GenericSteps.cs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 8f33df55..8099e538 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -19,8 +19,8 @@ public class DockerHelper protected Int32 TransactionProcessorPort; protected Int32 EventStorePort; - protected IContainerService EstateManagementContainer; - protected IContainerService TransactionProcessorContainer; + public IContainerService EstateManagementContainer; + public IContainerService TransactionProcessorContainer; protected IContainerService EventStoreContainer; public IEstateClient EstateClient; diff --git a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs index 93322f03..8f7372a3 100644 --- a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs +++ b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs @@ -5,6 +5,10 @@ namespace TransactionProcessor.IntegrationTests.Common { using System.Threading.Tasks; + using Ductus.FluentDocker.Executors; + using Ductus.FluentDocker.Extensions; + using Ductus.FluentDocker.Services; + using Ductus.FluentDocker.Services.Extensions; using TechTalk.SpecFlow; [Binding] @@ -33,6 +37,25 @@ public async Task StartSystem() [AfterScenario()] public async Task StopSystem() { + if (this.ScenarioContext.TestError != null) + { + // The test has failed, grab the logs from all the containers + List containers = new List(); + containers.Add(this.TestingContext.DockerHelper.EstateManagementContainer); + containers.Add(this.TestingContext.DockerHelper.TransactionProcessorContainer); + + foreach (IContainerService containerService in containers) + { + ConsoleStream logStream = containerService.Logs(); + IList logData = logStream.ReadToEnd(); + + foreach (String s in logData) + { + Console.Out.WriteLine(s); + } + } + } + await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false); } } From 16e01674a94dffcbc41d61995b22a4175409add2 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 11:56:45 +0000 Subject: [PATCH 03/22] :| --- TransactionProcessor.IntegrationTests/Common/GenericSteps.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs index 8f7372a3..d7d87b51 100644 --- a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs +++ b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs @@ -55,6 +55,10 @@ public async Task StopSystem() } } } + else + { + Console.Out.WriteLine("No Error :|"); + } await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false); } From 0cf70b12d030280ee2d1a78ace3614a0cfc51ed7 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 14:03:36 +0000 Subject: [PATCH 04/22] debugging more --- .../Common/GenericSteps.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs index d7d87b51..a2d4368f 100644 --- a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs +++ b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs @@ -25,8 +25,8 @@ public GenericSteps(ScenarioContext scenarioContext, this.ScenarioContext = scenarioContext; this.TestingContext = testingContext; } - - [BeforeScenario()] + + [BeforeScenario] public async Task StartSystem() { String scenarioName = this.ScenarioContext.ScenarioInfo.Title.Replace(" ", ""); @@ -34,9 +34,12 @@ public async Task StartSystem() await this.TestingContext.DockerHelper.StartContainersForScenarioRun(scenarioName).ConfigureAwait(false); } - [AfterScenario()] + [AfterScenario] public async Task StopSystem() { + Console.Out.WriteLine("In After Scenario"); + Console.Out.WriteLine(this.ScenarioContext.TestError != null); + if (this.ScenarioContext.TestError != null) { // The test has failed, grab the logs from all the containers From 2873852308cb730bcbb7a65aa28655c7edafcc7c Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 14:11:15 +0000 Subject: [PATCH 05/22] :| --- TransactionProcessor.IntegrationTests/Common/DockerHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 8099e538..8326fe6a 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -149,6 +149,8 @@ private void SetupEstateManagementContainer(String traceFolder) .Mount(traceFolder, "/home", MountType.ReadWrite) .Build() .Start().WaitForPort("5000/tcp", 30000); + + Console.Out.WriteLine("Started Estate Management"); } private void SetupTransactionProcessorContainer(String traceFolder) From aece4c2f6a3debda43f621128c14ebf98f3f0153 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 14:27:28 +0000 Subject: [PATCH 06/22] more debugging code --- .../Common/DockerHelper.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 8326fe6a..02114426 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -81,14 +81,17 @@ public async Task StartContainersForScenarioRun(String scenarioName) this.EstateManagementPort = this.EstateManagementContainer.ToHostExposedEndpoint("5000/tcp").Port; this.TransactionProcessorPort = this.TransactionProcessorContainer.ToHostExposedEndpoint("5002/tcp").Port; this.EventStorePort = this.EventStoreContainer.ToHostExposedEndpoint("2113/tcp").Port; - + + Console.Out.WriteLine("Started Estate Management on Port {this.EstateManagementPort}"); + // Setup the base address resolver Func estateManagementBaseAddressResolver = api => $"http://127.0.0.1:{this.EstateManagementPort}"; Func transactionProcessorBaseAddressResolver = api => $"http://127.0.0.1:{this.TransactionProcessorPort}"; HttpClient httpClient = new HttpClient(); + HttpClient httpClient2 = new HttpClient(); this.EstateClient = new EstateClient(estateManagementBaseAddressResolver, httpClient); - this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, httpClient); + this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, httpClient2); // TODO: Use this to talk to txn processor until we have a client //this.HttpClient = new HttpClient(); From fe785d8c49bdbee1af4968d80c4c02f0a24d8fba Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 14:32:52 +0000 Subject: [PATCH 07/22] :| --- TransactionProcessor.IntegrationTests/Common/DockerHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 02114426..5e8875af 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -82,7 +82,8 @@ public async Task StartContainersForScenarioRun(String scenarioName) this.TransactionProcessorPort = this.TransactionProcessorContainer.ToHostExposedEndpoint("5002/tcp").Port; this.EventStorePort = this.EventStoreContainer.ToHostExposedEndpoint("2113/tcp").Port; - Console.Out.WriteLine("Started Estate Management on Port {this.EstateManagementPort}"); + Console.Out.WriteLine($"Started Estate Management on Port {this.EstateManagementPort}"); + Console.Out.WriteLine($"Started Txn Processor Management on Port {this.TransactionProcessorPort}"); // Setup the base address resolver Func estateManagementBaseAddressResolver = api => $"http://127.0.0.1:{this.EstateManagementPort}"; From 22d10c819dc144a65610874bae40778324db3e54 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 14:41:51 +0000 Subject: [PATCH 08/22] :| --- .../Common/DockerHelper.cs | 4 ++-- .../Common/GenericSteps.cs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 5e8875af..d7f195ef 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -90,9 +90,9 @@ public async Task StartContainersForScenarioRun(String scenarioName) Func transactionProcessorBaseAddressResolver = api => $"http://127.0.0.1:{this.TransactionProcessorPort}"; HttpClient httpClient = new HttpClient(); - HttpClient httpClient2 = new HttpClient(); + //HttpClient httpClient2 = new HttpClient(); this.EstateClient = new EstateClient(estateManagementBaseAddressResolver, httpClient); - this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, httpClient2); + //this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, httpClient2); // TODO: Use this to talk to txn processor until we have a client //this.HttpClient = new HttpClient(); diff --git a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs index a2d4368f..a6b0b96d 100644 --- a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs +++ b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs @@ -42,6 +42,14 @@ public async Task StopSystem() if (this.ScenarioContext.TestError != null) { + Exception currentEx = this.ScenarioContext.TestError; + Console.Out.WriteLine(currentEx.Message); + while (currentEx.InnerException != null) + { + currentEx = currentEx.InnerException; + Console.Out.WriteLine(currentEx.Message); + } + // The test has failed, grab the logs from all the containers List containers = new List(); containers.Add(this.TestingContext.DockerHelper.EstateManagementContainer); From dad935898ec7b008d428b24e569d3d9daf3ff32c Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 14:47:40 +0000 Subject: [PATCH 09/22] :@ --- .../Common/DockerHelper.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index d7f195ef..8f7096ac 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -6,6 +6,8 @@ using System.Threading.Tasks; using Client; using Ductus.FluentDocker.Builders; + using Ductus.FluentDocker.Executors; + using Ductus.FluentDocker.Extensions; using Ductus.FluentDocker.Model.Builders; using Ductus.FluentDocker.Services; using Ductus.FluentDocker.Services.Extensions; @@ -83,6 +85,16 @@ public async Task StartContainersForScenarioRun(String scenarioName) this.EventStorePort = this.EventStoreContainer.ToHostExposedEndpoint("2113/tcp").Port; Console.Out.WriteLine($"Started Estate Management on Port {this.EstateManagementPort}"); + + + ConsoleStream logStream = this.EstateManagementContainer.Logs(); + IList logData = logStream.ReadToEnd(); + + foreach (String s in logData) + { + Console.Out.WriteLine(s); + } + Console.Out.WriteLine($"Started Txn Processor Management on Port {this.TransactionProcessorPort}"); // Setup the base address resolver From e602960dfb868cf8dbf71d3db8ecf97585ddfa5a Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 15:01:18 +0000 Subject: [PATCH 10/22] :| --- TransactionProcessor.IntegrationTests/Common/DockerHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 8f7096ac..a08842e4 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -154,7 +154,8 @@ private void SetupEstateManagementContainer(String traceFolder) this.EstateManagementContainer = new Builder() .UseContainer() .WithName(this.EstateManagementContainerName) - .WithEnvironment(this.EventStoreConnectionString) //, + .WithEnvironment(this.EventStoreConnectionString, + "urls=http://*:5000") //, //"AppSettings:MigrateDatabase=true", //"EventStoreSettings:START_PROJECTIONS=true", //"EventStoreSettings:ContinuousProjectionsFolder=/app/projections/continuous") From ec982dcbdfd86c0583056f0cc0e08d1385504994 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 20 Dec 2019 15:59:23 +0000 Subject: [PATCH 11/22] Update pullrequest.yml --- .github/workflows/pullrequest.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index ef09e2e9..8ae3fea8 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -16,6 +16,9 @@ jobs: steps: - uses: actions/checkout@v1 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v1 + - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: From 18d624974f1cc24168d19a2eb7e63cba01b4b035 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 16:16:53 +0000 Subject: [PATCH 12/22] :| --- .../Common/DockerHelper.cs | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index a08842e4..a8bf01d6 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -113,39 +113,39 @@ public async Task StartContainersForScenarioRun(String scenarioName) public async Task StopContainersForScenarioRun() { - try - { - if (this.TransactionProcessorContainer != null) - { - this.TransactionProcessorContainer.StopOnDispose = true; - this.TransactionProcessorContainer.RemoveOnDispose = true; - this.TransactionProcessorContainer.Dispose(); - } - - if (this.EstateManagementContainer != null) - { - this.EstateManagementContainer.StopOnDispose = true; - this.EstateManagementContainer.RemoveOnDispose = true; - this.EstateManagementContainer.Dispose(); - } - - if (this.EventStoreContainer != null) - { - this.EventStoreContainer.StopOnDispose = true; - this.EventStoreContainer.RemoveOnDispose = true; - this.EventStoreContainer.Dispose(); - } - - if (this.TestNetwork != null) - { - this.TestNetwork.Stop(); - this.TestNetwork.Remove(true); - } - } - catch (Exception e) - { - Console.WriteLine(e); - } + //try + //{ + // if (this.TransactionProcessorContainer != null) + // { + // this.TransactionProcessorContainer.StopOnDispose = true; + // this.TransactionProcessorContainer.RemoveOnDispose = true; + // this.TransactionProcessorContainer.Dispose(); + // } + + // if (this.EstateManagementContainer != null) + // { + // this.EstateManagementContainer.StopOnDispose = true; + // this.EstateManagementContainer.RemoveOnDispose = true; + // this.EstateManagementContainer.Dispose(); + // } + + // if (this.EventStoreContainer != null) + // { + // this.EventStoreContainer.StopOnDispose = true; + // this.EventStoreContainer.RemoveOnDispose = true; + // this.EventStoreContainer.Dispose(); + // } + + // if (this.TestNetwork != null) + // { + // this.TestNetwork.Stop(); + // this.TestNetwork.Remove(true); + // } + //} + //catch (Exception e) + //{ + // Console.WriteLine(e); + //} } private void SetupEstateManagementContainer(String traceFolder) From bf68f0d1bedb749969f0c96784387a792a2e60d6 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 20 Dec 2019 16:37:37 +0000 Subject: [PATCH 13/22] Update pullrequest.yml From 9f8697549d48e3124c6d6a31a596c39cad8f93f7 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 20 Dec 2019 16:45:10 +0000 Subject: [PATCH 14/22] Update pullrequest.yml --- .github/workflows/pullrequest.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 8ae3fea8..ef09e2e9 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -16,9 +16,6 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Setup tmate session - uses: mxschmitt/action-tmate@v1 - - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: From df6e5bd20493b96fb28b7811928ca1afc72a4ede Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 20 Dec 2019 16:55:20 +0000 Subject: [PATCH 15/22] Update pullrequest.yml --- .github/workflows/pullrequest.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index ef09e2e9..8ae3fea8 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -16,6 +16,9 @@ jobs: steps: - uses: actions/checkout@v1 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v1 + - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: From f4dd8b139b3243481717299594c8dcd06e3af3b1 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 20 Dec 2019 16:57:06 +0000 Subject: [PATCH 16/22] Update pullrequest.yml --- .github/workflows/pullrequest.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 8ae3fea8..eddb6f0c 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -16,9 +16,6 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Setup tmate session - uses: mxschmitt/action-tmate@v1 - - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: @@ -42,3 +39,6 @@ jobs: - name: Run Integration Tests run: dotnet test "TransactionProcessor.IntegrationTests\TransactionProcessor.IntegrationTests.csproj" --filter Category=PRTest + + - name: Setup tmate session + uses: mxschmitt/action-tmate@v1 From 36178fdef0a077c87d101d913b3539920f61d2e0 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 17:11:11 +0000 Subject: [PATCH 17/22] :| --- .../Common/DockerHelper.cs | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index a8bf01d6..e703657b 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -104,7 +104,7 @@ public async Task StartContainersForScenarioRun(String scenarioName) HttpClient httpClient = new HttpClient(); //HttpClient httpClient2 = new HttpClient(); this.EstateClient = new EstateClient(estateManagementBaseAddressResolver, httpClient); - //this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, httpClient2); + this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, httpClient); // TODO: Use this to talk to txn processor until we have a client //this.HttpClient = new HttpClient(); @@ -113,39 +113,39 @@ public async Task StartContainersForScenarioRun(String scenarioName) public async Task StopContainersForScenarioRun() { - //try - //{ - // if (this.TransactionProcessorContainer != null) - // { - // this.TransactionProcessorContainer.StopOnDispose = true; - // this.TransactionProcessorContainer.RemoveOnDispose = true; - // this.TransactionProcessorContainer.Dispose(); - // } - - // if (this.EstateManagementContainer != null) - // { - // this.EstateManagementContainer.StopOnDispose = true; - // this.EstateManagementContainer.RemoveOnDispose = true; - // this.EstateManagementContainer.Dispose(); - // } - - // if (this.EventStoreContainer != null) - // { - // this.EventStoreContainer.StopOnDispose = true; - // this.EventStoreContainer.RemoveOnDispose = true; - // this.EventStoreContainer.Dispose(); - // } - - // if (this.TestNetwork != null) - // { - // this.TestNetwork.Stop(); - // this.TestNetwork.Remove(true); - // } - //} - //catch (Exception e) - //{ - // Console.WriteLine(e); - //} + try + { + if (this.TransactionProcessorContainer != null) + { + this.TransactionProcessorContainer.StopOnDispose = true; + this.TransactionProcessorContainer.RemoveOnDispose = true; + this.TransactionProcessorContainer.Dispose(); + } + + if (this.EstateManagementContainer != null) + { + this.EstateManagementContainer.StopOnDispose = true; + this.EstateManagementContainer.RemoveOnDispose = true; + this.EstateManagementContainer.Dispose(); + } + + if (this.EventStoreContainer != null) + { + this.EventStoreContainer.StopOnDispose = true; + this.EventStoreContainer.RemoveOnDispose = true; + this.EventStoreContainer.Dispose(); + } + + if (this.TestNetwork != null) + { + this.TestNetwork.Stop(); + this.TestNetwork.Remove(true); + } + } + catch (Exception e) + { + Console.WriteLine(e); + } } private void SetupEstateManagementContainer(String traceFolder) From e9022230a69dff6eb3fe393ccfa0198dad24a9c5 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 17:25:56 +0000 Subject: [PATCH 18/22] :| --- .github/workflows/pullrequest.yml | 1 + TransactionProcessor.IntegrationTests/Common/DockerHelper.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index eddb6f0c..667c7626 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -41,4 +41,5 @@ jobs: run: dotnet test "TransactionProcessor.IntegrationTests\TransactionProcessor.IntegrationTests.csproj" --filter Category=PRTest - name: Setup tmate session + if: failure() uses: mxschmitt/action-tmate@v1 diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index e703657b..1ff9d8a3 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -104,7 +104,7 @@ public async Task StartContainersForScenarioRun(String scenarioName) HttpClient httpClient = new HttpClient(); //HttpClient httpClient2 = new HttpClient(); this.EstateClient = new EstateClient(estateManagementBaseAddressResolver, httpClient); - this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, httpClient); + this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, new HttpClient()); // TODO: Use this to talk to txn processor until we have a client //this.HttpClient = new HttpClient(); From d259d531386df8623fc44b0b9ffc6795d8030828 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Fri, 20 Dec 2019 17:33:29 +0000 Subject: [PATCH 19/22] more debugging --- TransactionProcessor.IntegrationTests/Common/GenericSteps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs index a6b0b96d..3ee011d1 100644 --- a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs +++ b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs @@ -71,7 +71,7 @@ public async Task StopSystem() Console.Out.WriteLine("No Error :|"); } - await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false); + //await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false); } } } From 41e612deeeef3a7fc0bd7b5b0ea111546afd4685 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Sat, 21 Dec 2019 07:32:35 +0000 Subject: [PATCH 20/22] :| --- .../Common/DockerHelper.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 1ff9d8a3..2c452eac 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -52,7 +52,7 @@ private void SetupEventStoreContainer(String traceFolder) .WithName(this.EventStoreContainerName) .WithEnvironment("EVENTSTORE_RUN_PROJECTIONS=all", "EVENTSTORE_START_STANDARD_PROJECTIONS=true") .UseNetwork(this.TestNetwork) - .Mount(traceFolder, "/var/log/eventstore", MountType.ReadWrite) + //.Mount(traceFolder, "/var/log/eventstore", MountType.ReadWrite) .Build() .Start().WaitForPort("2113/tcp", 30000); } @@ -85,16 +85,6 @@ public async Task StartContainersForScenarioRun(String scenarioName) this.EventStorePort = this.EventStoreContainer.ToHostExposedEndpoint("2113/tcp").Port; Console.Out.WriteLine($"Started Estate Management on Port {this.EstateManagementPort}"); - - - ConsoleStream logStream = this.EstateManagementContainer.Logs(); - IList logData = logStream.ReadToEnd(); - - foreach (String s in logData) - { - Console.Out.WriteLine(s); - } - Console.Out.WriteLine($"Started Txn Processor Management on Port {this.TransactionProcessorPort}"); // Setup the base address resolver @@ -163,7 +153,7 @@ private void SetupEstateManagementContainer(String traceFolder) .UseImage("stuartferguson/estatemanagement") .ExposePort(5000) .UseNetwork(new List { this.TestNetwork, Setup.DatabaseServerNetwork }.ToArray()) - .Mount(traceFolder, "/home", MountType.ReadWrite) + //.Mount(traceFolder, "/home", MountType.ReadWrite) .Build() .Start().WaitForPort("5000/tcp", 30000); @@ -183,7 +173,7 @@ private void SetupTransactionProcessorContainer(String traceFolder) .UseImage("transactionprocessor") .ExposePort(5002) .UseNetwork(new List { this.TestNetwork, Setup.DatabaseServerNetwork }.ToArray()) - .Mount(traceFolder, "/home", MountType.ReadWrite) + //.Mount(traceFolder, "/home", MountType.ReadWrite) .Build() .Start().WaitForPort("5002/tcp", 30000); } From 0f13933cca79747bb9f35ebadff9ed00c70a7d24 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Sat, 21 Dec 2019 07:47:23 +0000 Subject: [PATCH 21/22] :| --- TransactionProcessor.IntegrationTests/Common/GenericSteps.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs index 3ee011d1..e178ef8e 100644 --- a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs +++ b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs @@ -4,12 +4,14 @@ namespace TransactionProcessor.IntegrationTests.Common { + using System.Threading; using System.Threading.Tasks; using Ductus.FluentDocker.Executors; using Ductus.FluentDocker.Extensions; using Ductus.FluentDocker.Services; using Ductus.FluentDocker.Services.Extensions; using TechTalk.SpecFlow; + using TechTalk.SpecFlow.Plugins; [Binding] [Scope(Tag = "base")] @@ -32,6 +34,7 @@ public async Task StartSystem() String scenarioName = this.ScenarioContext.ScenarioInfo.Title.Replace(" ", ""); this.TestingContext.DockerHelper = new DockerHelper(); await this.TestingContext.DockerHelper.StartContainersForScenarioRun(scenarioName).ConfigureAwait(false); + Thread.Sleep(20000); } [AfterScenario] @@ -71,7 +74,7 @@ public async Task StopSystem() Console.Out.WriteLine("No Error :|"); } - //await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false); + await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false); } } } From b964075695b731645ed3e4a1034f516c0aff01d7 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Sat, 21 Dec 2019 07:54:58 +0000 Subject: [PATCH 22/22] might be working :O --- .../Common/DockerHelper.cs | 15 ++++----------- .../Common/GenericSteps.cs | 7 ------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs index 2c452eac..38eb014f 100644 --- a/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs +++ b/TransactionProcessor.IntegrationTests/Common/DockerHelper.cs @@ -52,7 +52,7 @@ private void SetupEventStoreContainer(String traceFolder) .WithName(this.EventStoreContainerName) .WithEnvironment("EVENTSTORE_RUN_PROJECTIONS=all", "EVENTSTORE_START_STANDARD_PROJECTIONS=true") .UseNetwork(this.TestNetwork) - //.Mount(traceFolder, "/var/log/eventstore", MountType.ReadWrite) + .Mount(traceFolder, "/var/log/eventstore", MountType.ReadWrite) .Build() .Start().WaitForPort("2113/tcp", 30000); } @@ -84,16 +84,11 @@ public async Task StartContainersForScenarioRun(String scenarioName) this.TransactionProcessorPort = this.TransactionProcessorContainer.ToHostExposedEndpoint("5002/tcp").Port; this.EventStorePort = this.EventStoreContainer.ToHostExposedEndpoint("2113/tcp").Port; - Console.Out.WriteLine($"Started Estate Management on Port {this.EstateManagementPort}"); - Console.Out.WriteLine($"Started Txn Processor Management on Port {this.TransactionProcessorPort}"); - // Setup the base address resolver Func estateManagementBaseAddressResolver = api => $"http://127.0.0.1:{this.EstateManagementPort}"; Func transactionProcessorBaseAddressResolver = api => $"http://127.0.0.1:{this.TransactionProcessorPort}"; - HttpClient httpClient = new HttpClient(); - //HttpClient httpClient2 = new HttpClient(); - this.EstateClient = new EstateClient(estateManagementBaseAddressResolver, httpClient); + this.EstateClient = new EstateClient(estateManagementBaseAddressResolver, new HttpClient()); this.TransactionProcessorClient = new TransactionProcessorClient(transactionProcessorBaseAddressResolver, new HttpClient()); // TODO: Use this to talk to txn processor until we have a client @@ -153,11 +148,9 @@ private void SetupEstateManagementContainer(String traceFolder) .UseImage("stuartferguson/estatemanagement") .ExposePort(5000) .UseNetwork(new List { this.TestNetwork, Setup.DatabaseServerNetwork }.ToArray()) - //.Mount(traceFolder, "/home", MountType.ReadWrite) + .Mount(traceFolder, "/home", MountType.ReadWrite) .Build() .Start().WaitForPort("5000/tcp", 30000); - - Console.Out.WriteLine("Started Estate Management"); } private void SetupTransactionProcessorContainer(String traceFolder) @@ -173,7 +166,7 @@ private void SetupTransactionProcessorContainer(String traceFolder) .UseImage("transactionprocessor") .ExposePort(5002) .UseNetwork(new List { this.TestNetwork, Setup.DatabaseServerNetwork }.ToArray()) - //.Mount(traceFolder, "/home", MountType.ReadWrite) + .Mount(traceFolder, "/home", MountType.ReadWrite) .Build() .Start().WaitForPort("5002/tcp", 30000); } diff --git a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs index e178ef8e..ff208e86 100644 --- a/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs +++ b/TransactionProcessor.IntegrationTests/Common/GenericSteps.cs @@ -40,9 +40,6 @@ public async Task StartSystem() [AfterScenario] public async Task StopSystem() { - Console.Out.WriteLine("In After Scenario"); - Console.Out.WriteLine(this.ScenarioContext.TestError != null); - if (this.ScenarioContext.TestError != null) { Exception currentEx = this.ScenarioContext.TestError; @@ -69,10 +66,6 @@ public async Task StopSystem() } } } - else - { - Console.Out.WriteLine("No Error :|"); - } await this.TestingContext.DockerHelper.StopContainersForScenarioRun().ConfigureAwait(false); }