[FA-misc] Reporting service seems to be working
This commit is contained in:
@@ -27,6 +27,11 @@ public class NovelImportSagaTests
|
||||
|
||||
var sagaHarness = harness.GetSagaStateMachineHarness<NovelImportSaga, NovelImportSagaState>();
|
||||
(await sagaHarness.Exists(importId, x => x.Importing)).HasValue.Should().BeTrue();
|
||||
|
||||
(await harness.Published.Any<IJobStatusUpdate>(x =>
|
||||
x.Context.Message.JobId == importId &&
|
||||
x.Context.Message.Status == JobStatus.InProgress &&
|
||||
x.Context.Message.JobType == "NovelImport")).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -45,6 +50,11 @@ public class NovelImportSagaTests
|
||||
|
||||
(await harness.Published.Any<INovelImportCompleted>(x =>
|
||||
x.Context.Message.ImportId == importId && x.Context.Message.Success)).Should().BeTrue();
|
||||
|
||||
(await harness.Published.Any<IJobStatusUpdate>(x =>
|
||||
x.Context.Message.JobId == importId &&
|
||||
x.Context.Message.Status == JobStatus.Completed &&
|
||||
x.Context.Message.JobType == "NovelImport")).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -79,6 +89,11 @@ public class NovelImportSagaTests
|
||||
|
||||
var sagaHarness = harness.GetSagaStateMachineHarness<NovelImportSaga, NovelImportSagaState>();
|
||||
(await sagaHarness.Exists(importId, x => x.Completed)).HasValue.Should().BeTrue();
|
||||
|
||||
(await harness.Published.Any<IJobStatusUpdate>(x =>
|
||||
x.Context.Message.JobId == importId &&
|
||||
x.Context.Message.Status == JobStatus.Completed &&
|
||||
x.Context.Message.JobType == "NovelImport")).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -121,6 +136,48 @@ public class NovelImportSagaTests
|
||||
|
||||
(await harness.Published.Any<INovelImportCompleted>(x =>
|
||||
x.Context.Message.ImportId == importId && x.Context.Message.Success)).Should().BeTrue();
|
||||
|
||||
(await harness.Published.Any<IJobStatusUpdate>(x =>
|
||||
x.Context.Message.JobId == importId &&
|
||||
x.Context.Message.Status == JobStatus.Completed &&
|
||||
x.Context.Message.JobType == "NovelImport")).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Should_publish_failed_job_status_on_chapter_pull_fault()
|
||||
{
|
||||
await using var provider = CreateTestProvider();
|
||||
var harness = provider.GetRequiredService<ITestHarness>();
|
||||
await harness.Start();
|
||||
|
||||
var importId = Guid.NewGuid();
|
||||
await harness.Bus.Publish<INovelImportRequested>(new NovelImportRequested(importId, "https://example.com/novel"));
|
||||
await harness.Bus.Publish<INovelMetadataImported>(new NovelMetadataImported(importId, 1, 1, false));
|
||||
|
||||
var sagaHarness = harness.GetSagaStateMachineHarness<NovelImportSaga, NovelImportSagaState>();
|
||||
(await sagaHarness.Exists(importId, x => x.Processing)).HasValue.Should().BeTrue();
|
||||
|
||||
await harness.Bus.Publish<Fault<IChapterPullRequested>>(new
|
||||
{
|
||||
Message = new ChapterPullRequested(importId, 1, 1, 1),
|
||||
Exceptions = new[]
|
||||
{
|
||||
new
|
||||
{
|
||||
ExceptionType = typeof(Exception).FullName!,
|
||||
Message = "Chapter pull failed",
|
||||
StackTrace = "stack trace",
|
||||
InnerException = (object?)null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
(await sagaHarness.Exists(importId, x => x.Failed)).HasValue.Should().BeTrue();
|
||||
|
||||
(await harness.Published.Any<IJobStatusUpdate>(x =>
|
||||
x.Context.Message.JobId == importId &&
|
||||
x.Context.Message.Status == JobStatus.Failed &&
|
||||
x.Context.Message.JobType == "NovelImport")).Should().BeTrue();
|
||||
}
|
||||
|
||||
private ServiceProvider CreateTestProvider()
|
||||
|
||||
Reference in New Issue
Block a user