From 6bc4b941ed9c20a344c7ea39f4e5f7318c155dcb Mon Sep 17 00:00:00 2001 From: Flaminel Date: Sun, 18 Oct 2026 13:10:00 +0300 Subject: [PATCH] fixed flaky dry-run history row assertion --- .../Features/Jobs/SeekerTests.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/backend/Cleanuparr.Infrastructure.Tests/Features/Jobs/SeekerTests.cs b/code/backend/Cleanuparr.Infrastructure.Tests/Features/Jobs/SeekerTests.cs index 01162ec7..00b4ada7 100644 --- a/code/backend/Cleanuparr.Infrastructure.Tests/Features/Jobs/SeekerTests.cs +++ b/code/backend/Cleanuparr.Infrastructure.Tests/Features/Jobs/SeekerTests.cs @@ -4889,7 +4889,7 @@ public class SeekerTests : IDisposable } [Fact] - public async Task ExecuteAsync_Radarr_LiveRunAfterDryRun_ClaimsDryRunHistoryRow() + public async Task ExecuteAsync_Radarr_LiveRunAfterDryRun_CreatesSeparateHistoryRow() { // Arrange - a dry run searches the item first var config = await _fixture.DataContext.SeekerConfigs.FirstAsync(); @@ -4942,12 +4942,16 @@ public class SeekerTests : IDisposable _dryRunInterceptor.IsDryRunEnabled().Returns(false); await CreateSut().ExecuteAsync(); - // Assert - live run owns the row, count restarts at 1 + // Assert - live run creates its own row, the dry row is untouched var history = await _fixture.EventsContext.SeekerHistory - .FirstOrDefaultAsync(h => h.ArrInstanceId == radarrInstance.Id && h.ExternalItemId == 1); + .FirstOrDefaultAsync(h => h.ArrInstanceId == radarrInstance.Id && h.ExternalItemId == 1 && !h.IsDryRun); history.ShouldNotBeNull(); history.IsDryRun.ShouldBeFalse(); history.SearchCount.ShouldBe(1); + + int dryRowCount = await _fixture.EventsContext.SeekerHistory + .CountAsync(h => h.ArrInstanceId == radarrInstance.Id && h.ExternalItemId == 1 && h.IsDryRun); + dryRowCount.ShouldBe(1); } [Fact]