test(264): pin the path-scan-error log; correct testing.md accuracy
Build ErsatzTV Image / CI image pin matches docker/ci (pull_request) Successful in 7s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 8s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 6s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 8s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 38s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 10m49s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 15m6s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 15m9s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / CI image pin matches docker/ci (pull_request) Successful in 7s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 8s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 6s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 8s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 38s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 10m49s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 15m6s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 15m9s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Re-review of the previous fix commit (986ccfaf, verdict MERGEABLE)
raised one fair hit and one claim that did not survive checking.
Fair hit — that commit's message asserted "LogError is an extension
method that NSubstitute can't cleanly verify" as the reason for adding
no test. That is FALSE, and this repo disproves it:
ErsatzTV.Tests' ReleaseMemoryHandlerTests.ShouldHaveLogged asserts on
ILogger via ReceivedCalls(), which works precisely because the LogError
extension dispatches to the substituted ILogger.Log. Reusing that idiom
here costs 4 lines, so pin the log the previous commit added. Verified
non-vacuous: asserting a message the handler never logs fails the test.
Not applied — the same review called the row's "1471 tests" misleading
on the grounds that TranscodingTests is [Explicit] and contributes most
of that count. TranscodingTests is indeed [Explicit], but filtering it
out yields exactly 1471, so 1471 is already the runnable count and the
row was accurate. Kept the number; documented TranscodingTests as
[Explicit]/opt-in instead, since it was a genuine omission from a table
that claims to be authoritative.
Also rewrap the verification-gate paragraph the previous commit left
over-long, and name the two always-run projects instead of "both".
Deferred (filed separately): a canceled local scan now logs at ERROR
per path via this log. It mirrors the remote handlers exactly, so
diverging here would be the inconsistency, not the fix.
This commit is contained in:
@@ -27,6 +27,7 @@ public class ScanLocalLibraryHandlerTests
|
||||
_libraryRepository = Substitute.For<ILibraryRepository>();
|
||||
_configElementRepository = Substitute.For<IConfigElementRepository>();
|
||||
_movieFolderScanner = Substitute.For<IMovieFolderScanner>();
|
||||
_logger = Substitute.For<ILogger<ScanLocalLibraryHandler>>();
|
||||
|
||||
_library = new LocalLibrary
|
||||
{
|
||||
@@ -57,6 +58,7 @@ public class ScanLocalLibraryHandlerTests
|
||||
private ILibraryRepository _libraryRepository;
|
||||
private IConfigElementRepository _configElementRepository;
|
||||
private IMovieFolderScanner _movieFolderScanner;
|
||||
private ILogger<ScanLocalLibraryHandler> _logger;
|
||||
private LocalLibrary _library;
|
||||
|
||||
[Test]
|
||||
@@ -88,6 +90,10 @@ public class ScanLocalLibraryHandlerTests
|
||||
|
||||
_library.LastScan.ShouldBeNull();
|
||||
await _libraryRepository.DidNotReceive().UpdateLastScan(Arg.Any<Library>());
|
||||
|
||||
// a failed path suppresses the library-level scan time, reproducing the #264 symptom;
|
||||
// without this log the user would have nothing explaining why
|
||||
ShouldHaveLogged("Error scanning local library path /movies: scan failed");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -168,6 +174,13 @@ public class ScanLocalLibraryHandlerTests
|
||||
Substitute.For<ISongFolderScanner>(),
|
||||
Substitute.For<IImageFolderScanner>(),
|
||||
Substitute.For<IRemoteStreamFolderScanner>(),
|
||||
Substitute.For<ILogger<ScanLocalLibraryHandler>>());
|
||||
_logger);
|
||||
|
||||
// asserts on the substituted ILogger.Log call the LogError extension dispatches to
|
||||
// (same idiom as ErsatzTV.Tests' ReleaseMemoryHandlerTests.ShouldHaveLogged)
|
||||
private void ShouldHaveLogged(string expectedMessage) =>
|
||||
_logger.ReceivedCalls()
|
||||
.Any(call => call.GetArguments().ElementAtOrDefault(2)?.ToString() == expectedMessage)
|
||||
.ShouldBeTrue();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user