Skip to content

Commit

Permalink
Disables parrallel bus processing for integration tests. Switching in…
Browse files Browse the repository at this point in the history
…tegration tests to use new test base class
  • Loading branch information
craigedmunds committed Jan 6, 2025
1 parent e95479b commit c6684e7
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 222 deletions.
4 changes: 0 additions & 4 deletions Btms.Analytics.Tests/MovementsByMaxVersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@

namespace Btms.Analytics.Tests;

// [Collection(nameof(BasicSampleDataTestCollection))]
// public class MovementsByMaxVersionTests(
// BasicSampleDataTestFixture basicSampleDataTestFixture,
// ITestOutputHelper testOutputHelper)
public class MovementsByMaxVersionTests(ITestOutputHelper output)
: ScenarioGeneratorBaseTest<CrNoMatchSingleItemWithDecisionScenarioGenerator>(output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,37 @@
using Btms.Types.Alvs;
using Btms.Types.Ipaffs;
using FluentAssertions;
using TestDataGenerator.Scenarios;
using TestDataGenerator.Scenarios.ChedP;
using TestGenerator.IntegrationTesting.Backend;
using Xunit;
using Xunit.Abstractions;

namespace Btms.Backend.IntegrationTests.DecisionTests;

[Trait("Category", "Integration")]
public class ChedPUpdatedNotificationTests(InMemoryScenarioApplicationFactory<MultiStepScenarioGenerator> factory, ITestOutputHelper testOutputHelper)
: BaseApiTests(factory, testOutputHelper, "DecisionTests"), IClassFixture<InMemoryScenarioApplicationFactory<MultiStepScenarioGenerator>>
// public class ChedPUpdatedNotificationTests(InMemoryScenarioApplicationFactory<MultiStepScenarioGenerator> factory, ITestOutputHelper testOutputHelper)
// : BaseApiTests(factory, testOutputHelper, "DecisionTests"), IClassFixture<InMemoryScenarioApplicationFactory<MultiStepScenarioGenerator>>

public class ChedPUpdatedNotificationTests(ITestOutputHelper output)
: ScenarioGeneratorBaseTest<MultiStepScenarioGenerator>(output)
{

[Fact(Skip = "We're not currently re-linking when a new version of notification arrives it seems")]
// [Fact]
public void MultipleNotificationVersionScenario_ShouldBeLinkedAndMatchDecision()
{
// Arrange
var loadedData = factory.LoadedData;
var loadedData = LoadedData;

var chedPMovement = (AlvsClearanceRequest)loadedData.Single(d =>
d is { generator: MultiStepScenarioGenerator, message: AlvsClearanceRequest })
.message;
d is { Message: AlvsClearanceRequest })
.Message;

// The scenario has multiple versions of the same notification so we just want one of them.
var chedPNotification = (ImportNotification)loadedData.FirstOrDefault(d =>
d is { generator: MultiStepScenarioGenerator, message: ImportNotification })
.message;
var chedPNotification = (ImportNotification)LoadedData.Single(d =>
d is { Message: ImportNotification })
.Message;

// Act
var jsonClientResponse = Client.AsJsonApiClient().GetById(chedPMovement!.Header!.EntryReference!, "api/movements");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
using Btms.Model;
using FluentAssertions;
using TestDataGenerator.Scenarios;
using TestGenerator.IntegrationTesting.Backend;
using Xunit;
using Xunit.Abstractions;

namespace Btms.Backend.IntegrationTests.DecisionTests;

[Trait("Category", "Integration")]
public class ManyItemTests(InMemoryScenarioApplicationFactory<CrNoMatchScenarioGenerator> factory, ITestOutputHelper testOutputHelper)
: BaseApiTests(factory, testOutputHelper, "DecisionTests"), IClassFixture<InMemoryScenarioApplicationFactory<CrNoMatchScenarioGenerator>>
public class ManyItemTests(ITestOutputHelper output)
: ScenarioGeneratorBaseTest<CrNoMatchScenarioGenerator>(output)
{

[Fact]
Expand Down

This file was deleted.

18 changes: 8 additions & 10 deletions Btms.Backend.IntegrationTests/MatchingTests/ChedNoMatchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,29 @@
using Btms.Types.Ipaffs;
using FluentAssertions;
using TestDataGenerator.Scenarios.SpecificFiles;
using TestGenerator.IntegrationTesting.Backend;
using Xunit;
using Xunit.Abstractions;

namespace Btms.Backend.IntegrationTests.MatchingTests;

[Trait("Category", "Integration")]
public class UnmatchedChedTests(
InMemoryScenarioApplicationFactory<AllChedsNoMatchScenarioGenerator> factory,
ITestOutputHelper testOutputHelper)
: BaseApiTests(factory, testOutputHelper, "MatchingTests"),
IClassFixture<InMemoryScenarioApplicationFactory<AllChedsNoMatchScenarioGenerator>>
public class UnmatchedChedTests(ITestOutputHelper output)
: ScenarioGeneratorBaseTest<AllChedsNoMatchScenarioGenerator>(output)
{
[Fact]
public void ChedsWithNoCR_ShouldNotMatch()
{
// Arrange
var loadedData = factory.LoadedData;
var loadedData = LoadedData;
var chedA = (ImportNotification)loadedData.Single(d =>
d.message is ImportNotification { ImportNotificationType: ImportNotificationTypeEnum.Cveda }).message;
d.Message is ImportNotification { ImportNotificationType: ImportNotificationTypeEnum.Cveda }).Message;
var chedD = (ImportNotification)loadedData.Single(d =>
d.message is ImportNotification { ImportNotificationType: ImportNotificationTypeEnum.Ced }).message;
d.Message is ImportNotification { ImportNotificationType: ImportNotificationTypeEnum.Ced }).Message;
var chedP = (ImportNotification)loadedData.Single(d =>
d.message is ImportNotification { ImportNotificationType: ImportNotificationTypeEnum.Cvedp }).message;
d.Message is ImportNotification { ImportNotificationType: ImportNotificationTypeEnum.Cvedp }).Message;
var chedPP = (ImportNotification)loadedData.Single(d =>
d.message is ImportNotification { ImportNotificationType: ImportNotificationTypeEnum.Chedpp }).message;
d.Message is ImportNotification { ImportNotificationType: ImportNotificationTypeEnum.Chedpp }).Message;


// // Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
using FluentAssertions;
using TestDataGenerator.Scenarios.ChedP;
using TestDataGenerator.Scenarios.SpecificFiles;
using TestGenerator.IntegrationTesting.Backend;
using Xunit;
using Xunit.Abstractions;

namespace Btms.Backend.IntegrationTests.PreprocessingTests;

[Trait("Category", "Integration")]
public class EnsureAuditEntryIsAddedForMovementUpdatesTests(InMemoryScenarioApplicationFactory<NoAuditLogForMovementUpdate> factory, ITestOutputHelper testOutputHelper)
: BaseApiTests(factory, testOutputHelper, "DecisionTests"), IClassFixture<InMemoryScenarioApplicationFactory<NoAuditLogForMovementUpdate>>
public class EnsureAuditEntryIsAddedForMovementUpdatesTests(ITestOutputHelper output)
: ScenarioGeneratorBaseTest<NoAuditLogForMovementUpdate>(output)
{

[Fact]
public void ShouldHaveUpdatedAuditEntry()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@
using Btms.Types.Alvs;
using FluentAssertions;
using TestDataGenerator.Scenarios.SpecificFiles;
using TestGenerator.IntegrationTesting.Backend;
using Xunit;
using Xunit.Abstractions;

namespace Btms.Backend.IntegrationTests.PreprocessingTests;

[Trait("Category", "Integration")]
public class EnsureDuplicateItemsAreNotCreatedTests(InMemoryScenarioApplicationFactory<DuplicateMovementItems_CDMS_211> factory, ITestOutputHelper testOutputHelper)
: BaseApiTests(factory, testOutputHelper, "DecisionTests"), IClassFixture<InMemoryScenarioApplicationFactory<DuplicateMovementItems_CDMS_211>>
public class EnsureDuplicateItemsAreNotCreatedTests(ITestOutputHelper output)
: ScenarioGeneratorBaseTest<DuplicateMovementItems_CDMS_211>(output)

// public class EnsureDuplicateItemsAreNotCreatedTests(InMemoryScenarioApplicationFactory<DuplicateMovementItems_CDMS_211> factory, ITestOutputHelper testOutputHelper)
// : BaseApiTests(factory, testOutputHelper, "DecisionTests"), IClassFixture<InMemoryScenarioApplicationFactory<DuplicateMovementItems_CDMS_211>>
{

[Fact(Skip = "We're ending up with 2 items on the clearance request here.")]
// [Fact]
public void ShouldNotCreateDuplicateItems()
{
// Arrange
var loadedData = factory.LoadedData;
var loadedData = LoadedData;

var movementMessage = (AlvsClearanceRequest)loadedData.First(d =>
d is { message: AlvsClearanceRequest })
.message;
d is { Message: AlvsClearanceRequest })
.Message;


// Act
Expand Down
3 changes: 0 additions & 3 deletions TestDataGenerator/Scenarios/CRNoMatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace TestDataGenerator.Scenarios;

public static class NoMatchExtensions
{

public static AlvsClearanceRequest CompleteSimpleClearanceRequest(int scenario, int item, DateTime entryDate, ScenarioConfig config)
{
return NoMatchExtensions
Expand Down Expand Up @@ -141,7 +140,6 @@ public override GeneratorResult Generate(int scenario, int item, DateTime entryD
}
}


public class CrNonContiguousDecisionsScenarioGenerator(ILogger<CrNonContiguousDecisionsScenarioGenerator> logger) : ScenarioGenerator
{
public override GeneratorResult Generate(int scenario, int item, DateTime entryDate, ScenarioConfig config)
Expand Down Expand Up @@ -169,7 +167,6 @@ public override GeneratorResult Generate(int scenario, int item, DateTime entryD
}
}


public class CrDecisionWithoutV1ScenarioGenerator(ILogger<CrDecisionWithoutV1ScenarioGenerator> logger) : ScenarioGenerator
{
public override GeneratorResult Generate(int scenario, int item, DateTime entryDate, ScenarioConfig config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ protected override void ConfigureWebHost(IWebHostBuilder builder)
{ "DisableLoadIniFile", "true" },
{ "BlobServiceOptions:CachePath", "Scenarios/Samples" },
{ "BlobServiceOptions:CacheReadEnabled", "true" },
{ "AuthKeyStore:Credentials:IntTest", "Password" }
{ "AuthKeyStore:Credentials:IntTest", "Password" },

{ "ConsumerOptions:EnableBlockingPublish", "true" }
};

var configuration = new ConfigurationBuilder()
Expand Down

0 comments on commit c6684e7

Please sign in to comment.