diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-09-03 11:51:02 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-09-03 11:51:02 +0200 |
| commit | b724e57458e60e967bf05e943c5cf6b1a41f4044 (patch) | |
| tree | 9ec216e1c55f0a818d89440a54817e9d50506b5b /tests | |
| parent | d73e3d964e3ce8197ec86bdaad447072305bc0d6 (diff) | |
Reduce comments
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Jellyfin.Controller.Tests/DirectoryServiceTests.cs | 14 | ||||
| -rw-r--r-- | tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs | 18 |
2 files changed, 7 insertions, 25 deletions
diff --git a/tests/Jellyfin.Controller.Tests/DirectoryServiceTests.cs b/tests/Jellyfin.Controller.Tests/DirectoryServiceTests.cs index a550828783..338ee9c903 100644 --- a/tests/Jellyfin.Controller.Tests/DirectoryServiceTests.cs +++ b/tests/Jellyfin.Controller.Tests/DirectoryServiceTests.cs @@ -268,9 +268,7 @@ namespace Jellyfin.Controller.Tests [Fact] public void GetFileSystemEntries_FarMorePathsThanTheCacheHolds_EvictsInsteadOfGrowing() { - // The cache outlives every DirectoryService that reads it, so it has to give entries back - // rather than hold every path the server ever saw. Asking for more paths than it can hold - // must push the first one out, which shows up as the file system being read for it twice. + // Eviction of the first path shows up as the file system being read for it twice. const int PathCount = 8192; var fileSystemMock = new Mock<IFileSystem>(); @@ -295,8 +293,6 @@ namespace Jellyfin.Controller.Tests [Fact] public void GetFileSystemEntries_SecondServiceOverSameFileSystem_ReusesTheFirstAnswer() { - // The library code news up a DirectoryService per item, so what one of them learned about - // a directory has to be worth something to the next one reading the same file system. var fileSystemMock = new Mock<IFileSystem>(); fileSystemMock.Setup(f => f.GetFileSystemEntries(LowerCasePath)) .Returns(_lowerCaseFileSystemMetadata); @@ -328,8 +324,6 @@ namespace Jellyfin.Controller.Tests [Fact] public void Invalidate_GivenADirectory_DropsBothTheListingAndTheFilePaths() { - // Clearing only one of the two views of a directory leaves the other one answering from - // before whatever was just written there. var fileSystemMock = new Mock<IFileSystem>(); fileSystemMock.SetupSequence(f => f.GetFileSystemEntries(LowerCasePath)) .Returns(_lowerCaseFileSystemMetadata) @@ -351,7 +345,6 @@ namespace Jellyfin.Controller.Tests [Fact] public void Invalidate_GivenAFile_DropsTheListingOfTheDirectoryHoldingIt() { - // Downloading a subtitle changes what its folder contains, not just the one path. const string NewFile = LowerCasePath + "/Song 2.srt"; var fileSystemMock = new Mock<IFileSystem>(); @@ -370,8 +363,6 @@ namespace Jellyfin.Controller.Tests [Fact] public void Invalidate_OnOneService_IsSeenByAnotherOverTheSameFileSystem() { - // Whoever writes the file and whoever refreshes the item hold different services, so - // invalidating has to reach the cache both of them read. var fileSystemMock = new Mock<IFileSystem>(); fileSystemMock.SetupSequence(f => f.GetFileSystemEntries(LowerCasePath)) .Returns(_lowerCaseFileSystemMetadata) @@ -388,8 +379,6 @@ namespace Jellyfin.Controller.Tests [Fact] public void GetFilePaths_ClearingTheCache_KeepsTheParentDirectory() { - // Re-reading one directory is not a reason to make the server list the library folder - // holding it again, which the shared cache would otherwise have to do. const string ParentPath = "/music"; var fileSystemMock = new Mock<IFileSystem>(); @@ -421,7 +410,6 @@ namespace Jellyfin.Controller.Tests Assert.Null(directoryService.GetFileSystemEntry(MissingPath)); - // The one answer that changes on its own: the file turning up has to be visible. Assert.NotNull(directoryService.GetFileSystemEntry(MissingPath)); } } diff --git a/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs b/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs index b3f5af76b7..248b236df8 100644 --- a/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs +++ b/tests/Jellyfin.Providers.Tests/Manager/ProviderManagerTests.cs @@ -381,10 +381,6 @@ namespace Jellyfin.Providers.Tests.Manager [Fact] public async Task QueueRefresh_ManyItemsQueuedFromManyThreads_ProcessesEveryOne() { - // The queue is filled from whichever thread wants a refresh and drained by a processor of - // its own, so an unsynchronised PriorityQueue can lose entries outright, and a processor - // that stands down before releasing its flag leaves whatever was queued in that gap with - // nobody to drain it. Either way an item silently never gets refreshed. const int ItemCount = 2000; var queued = Enumerable.Range(0, ItemCount).Select(_ => Guid.NewGuid()).ToArray(); @@ -395,7 +391,7 @@ namespace Jellyfin.Providers.Tests.Manager libraryManager.Setup(i => i.GetItemById(It.IsAny<Guid>())) .Returns((Guid id) => { - // Returning null drains the entry without needing the whole refresh machinery. + // Returning null drains the entry without the whole refresh machinery. processed.Add(id); if (processed.Count == ItemCount) { @@ -425,7 +421,7 @@ namespace Jellyfin.Providers.Tests.Manager } catch (OperationCanceledException) { - // Fall through, so the assertions below name what was lost rather than the wait. + // Fall through so the assertions report what was lost. } Assert.Empty(providerManager.GetRefreshQueue()); @@ -435,9 +431,8 @@ namespace Jellyfin.Providers.Tests.Manager [Fact] public async Task QueueRefresh_RefreshCancelsForItsOwnReasons_KeepsDrainingTheQueue() { - // MetadataService rethrows OperationCanceledException out of a provider, so an HTTP - // timeout against an unreachable metadata server arrives here looking exactly like a - // shutdown. Treating it as one stops the processor and strands the rest of the queue. + // A provider timeout arrives as an OperationCanceledException, indistinguishable from + // a shutdown; treating it as one would strand the rest of the queue. const int ItemCount = 200; var queued = Enumerable.Range(0, ItemCount).Select(_ => Guid.NewGuid()).ToArray(); @@ -454,8 +449,7 @@ namespace Jellyfin.Providers.Tests.Manager { cancelledOnce = true; - // Hold the first entry until the whole batch is queued, so everything that - // follows it is already waiting when the cancellation lands. + // Hold the first entry until the whole batch is queued. allQueued.Wait(TimeSpan.FromSeconds(30)); throw new OperationCanceledException("provider timed out"); } @@ -487,7 +481,7 @@ namespace Jellyfin.Providers.Tests.Manager } catch (OperationCanceledException) { - // Fall through, so the assertions below name what was left stranded. + // Fall through so the assertions report what was stranded. } Assert.Empty(providerManager.GetRefreshQueue()); |
