aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Implementations.Tests
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2026-05-06 20:49:19 +0200
committerGitHub <noreply@github.com>2026-05-06 20:49:19 +0200
commit33ed52b8ee25e1fae4763a26337b838dc9782b26 (patch)
treeee68da202f604eef267254ea8c689965098b1c3e /tests/Jellyfin.Server.Implementations.Tests
parentaa96ff42e616ecf5638a8f1e2e8459b94513c528 (diff)
parentd1ab428476f961426841a0561036c59c3b93878e (diff)
Merge branch 'master' into feature/season-provider-id-from-path
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests')
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs16
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj4
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Library/DotIgnoreIgnoreRuleTest.cs392
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs57
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.cs14
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs9
6 files changed, 470 insertions, 22 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs b/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs
index 6997b51ac8..c06279af2d 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/IO/ManagedFileSystemTests.cs
@@ -25,12 +25,12 @@ public class ManagedFileSystemTests
public void MoveDirectory_SameFileSystem_Correct()
=> MoveDirectoryInternal();
- [SkippableFact]
+ [Fact]
public void MoveDirectory_DifferentFileSystem_Correct()
{
const string DestinationParent = "/dev/shm";
- Skip.IfNot(Directory.Exists(DestinationParent));
+ Assert.SkipUnless(Directory.Exists(DestinationParent), $"{DestinationParent} is not available");
MoveDirectoryInternal(DestinationParent);
}
@@ -57,7 +57,7 @@ public class ManagedFileSystemTests
Directory.Delete(destinationDir, true);
}
- [SkippableTheory]
+ [Theory]
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Beethoven/Misc/Moonlight Sonata.mp3")]
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "../../Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Beethoven/Misc/Moonlight Sonata.mp3")]
[InlineData("/Volumes/Library/Sample/Music/Playlists/", "Beethoven/Misc/Moonlight Sonata.mp3", "/Volumes/Library/Sample/Music/Playlists/Beethoven/Misc/Moonlight Sonata.mp3")]
@@ -67,13 +67,13 @@ public class ManagedFileSystemTests
string filePath,
string expectedAbsolutePath)
{
- Skip.If(OperatingSystem.IsWindows());
+ Assert.SkipWhen(OperatingSystem.IsWindows(), "Unix-only test");
var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
Assert.Equal(expectedAbsolutePath, generatedPath);
}
- [SkippableTheory]
+ [Theory]
[InlineData(@"C:\\Volumes\Library\Sample\Music\Playlists\", @"..\Beethoven\Misc\Moonlight Sonata.mp3", @"C:\Volumes\Library\Sample\Music\Beethoven\Misc\Moonlight Sonata.mp3")]
[InlineData(@"C:\\Volumes\Library\Sample\Music\Playlists\", @"..\..\Beethoven\Misc\Moonlight Sonata.mp3", @"C:\Volumes\Library\Sample\Beethoven\Misc\Moonlight Sonata.mp3")]
[InlineData(@"C:\\Volumes\Library\Sample\Music\Playlists\", @"Beethoven\Misc\Moonlight Sonata.mp3", @"C:\Volumes\Library\Sample\Music\Playlists\Beethoven\Misc\Moonlight Sonata.mp3")]
@@ -83,7 +83,7 @@ public class ManagedFileSystemTests
string filePath,
string expectedAbsolutePath)
{
- Skip.IfNot(OperatingSystem.IsWindows());
+ Assert.SkipUnless(OperatingSystem.IsWindows(), "Windows-only test");
var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
@@ -100,10 +100,10 @@ public class ManagedFileSystemTests
Assert.Equal(expectedFileName, _sut.GetValidFilename(filename));
}
- [SkippableFact]
+ [Fact]
public void GetFileInfo_DanglingSymlink_ExistsFalse()
{
- Skip.If(OperatingSystem.IsWindows());
+ Assert.SkipWhen(OperatingSystem.IsWindows(), "Unix-only test");
string testFileDir = Path.Combine(Path.GetTempPath(), "jellyfin-test-data");
string testFileName = Path.Combine(testFileDir, Path.GetRandomFileName() + "-danglingsym.link");
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
index 4e2604e6e1..958ffb8b6e 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
+++ b/tests/Jellyfin.Server.Implementations.Tests/Jellyfin.Server.Implementations.Tests.csproj
@@ -3,6 +3,7 @@
<!-- ProjectGuid is only included as a requirement for SonarQube analysis -->
<PropertyGroup>
<ProjectGuid>{2E3A1B4B-4225-4AAA-8B29-0181A84E7AEE}</ProjectGuid>
+ <OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
@@ -16,12 +17,11 @@
<PackageReference Include="AutoFixture.AutoMoq" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
- <PackageReference Include="xunit" />
+ <PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="Xunit.SkippableFact" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Library/DotIgnoreIgnoreRuleTest.cs b/tests/Jellyfin.Server.Implementations.Tests/Library/DotIgnoreIgnoreRuleTest.cs
index a7bbef7ed4..03c0b4af39 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Library/DotIgnoreIgnoreRuleTest.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Library/DotIgnoreIgnoreRuleTest.cs
@@ -1,4 +1,9 @@
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
using Emby.Server.Implementations.Library;
+using MediaBrowser.Model.IO;
using Xunit;
namespace Jellyfin.Server.Implementations.Tests.Library;
@@ -78,4 +83,391 @@ public class DotIgnoreIgnoreRuleTest
// Without normalization, Windows paths with backslashes won't match patterns expecting forward slashes
Assert.False(DotIgnoreIgnoreRule.CheckIgnoreRules(path, _rule1, isDirectory: false, normalizePath: false));
}
+
+ [Fact]
+ public void CacheHit_RepeatedCallsDoNotRereadFiles()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+ var subDir = Path.Combine(tempDir, "subdir");
+ Directory.CreateDirectory(subDir);
+
+ try
+ {
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, "*.tmp");
+
+ var rule = new DotIgnoreIgnoreRule();
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(subDir, "test.tmp"),
+ IsDirectory = false
+ };
+
+ // First call - should cache
+ var result1 = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result1);
+
+ // Second call - should use cache
+ var result2 = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result2);
+
+ // Third call with different file in same directory - should use cache
+ var fileInfo2 = new FileSystemMetadata
+ {
+ FullName = Path.Combine(subDir, "other.tmp"),
+ IsDirectory = false
+ };
+ var result3 = rule.ShouldIgnore(fileInfo2, null);
+ Assert.True(result3);
+
+ // Call with file that doesn't match pattern
+ var fileInfo3 = new FileSystemMetadata
+ {
+ FullName = Path.Combine(subDir, "other.txt"),
+ IsDirectory = false
+ };
+ var result4 = rule.ShouldIgnore(fileInfo3, null);
+ Assert.False(result4);
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+
+ [Fact]
+ public void CacheInvalidation_ModifyIgnoreFile_Reparses()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+
+ try
+ {
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, "*.tmp");
+
+ var rule = new DotIgnoreIgnoreRule();
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, "test.tmp"),
+ IsDirectory = false
+ };
+
+ // First call - should ignore .tmp files
+ var result1 = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result1);
+
+ // Modify the .ignore file to ignore .txt instead
+ // Wait a bit to ensure the file modification time changes
+ Thread.Sleep(50);
+ File.WriteAllText(ignoreFilePath, "*.txt");
+
+ // Now .tmp files should NOT be ignored
+ var result2 = rule.ShouldIgnore(fileInfo, null);
+ Assert.False(result2);
+
+ // And .txt files SHOULD be ignored
+ var txtFileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, "test.txt"),
+ IsDirectory = false
+ };
+ var result3 = rule.ShouldIgnore(txtFileInfo, null);
+ Assert.True(result3);
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+
+ [Fact]
+ public void EmptyIgnoreFile_IgnoresEverything()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+
+ try
+ {
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, string.Empty);
+
+ var rule = new DotIgnoreIgnoreRule();
+
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, "anyfile.mkv"),
+ IsDirectory = false
+ };
+
+ // Empty .ignore file should ignore everything
+ var result = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result);
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+
+ [Fact]
+ public void WhitespaceOnlyIgnoreFile_IgnoresEverything()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+
+ try
+ {
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, " \n\t\n ");
+
+ var rule = new DotIgnoreIgnoreRule();
+
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, "anyfile.mkv"),
+ IsDirectory = false
+ };
+
+ // Whitespace-only .ignore file should ignore everything
+ var result = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result);
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+
+ [Fact]
+ public void NoIgnoreFile_DoesNotIgnore()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+
+ try
+ {
+ var rule = new DotIgnoreIgnoreRule();
+
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, "anyfile.mkv"),
+ IsDirectory = false
+ };
+
+ // No .ignore file means don't ignore
+ var result = rule.ShouldIgnore(fileInfo, null);
+ Assert.False(result);
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+
+ [Fact]
+ public void ConcurrentAccess_ThreadSafe()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+
+ try
+ {
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, "*.tmp");
+
+ var rule = new DotIgnoreIgnoreRule();
+
+ // Run multiple parallel checks
+ Parallel.For(0, 100, i =>
+ {
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, $"test{i}.tmp"),
+ IsDirectory = false
+ };
+
+ var result = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result);
+ });
+
+ // Also test with non-matching files
+ Parallel.For(0, 100, i =>
+ {
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, $"test{i}.txt"),
+ IsDirectory = false
+ };
+
+ var result = rule.ShouldIgnore(fileInfo, null);
+ Assert.False(result);
+ });
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+
+ [Fact]
+ public void ClearCache_ClearsAllCachedData()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+
+ try
+ {
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, "*.tmp");
+
+ var rule = new DotIgnoreIgnoreRule();
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, "test.tmp"),
+ IsDirectory = false
+ };
+
+ // First call to populate cache
+ var result1 = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result1);
+
+ // Clear cache
+ rule.ClearDirectoryCache();
+
+ // Should still work (will re-populate cache)
+ var result2 = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result2);
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+
+ [Fact]
+ public void IgnoreFileDeleted_HandlesGracefully()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+
+ try
+ {
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, "*.tmp");
+
+ var rule = new DotIgnoreIgnoreRule();
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, "test.tmp"),
+ IsDirectory = false
+ };
+
+ // First call - should ignore
+ var result1 = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result1);
+
+ // Delete the .ignore file
+ File.Delete(ignoreFilePath);
+
+ // Should not ignore anymore (file deleted)
+ var result2 = rule.ShouldIgnore(fileInfo, null);
+ Assert.False(result2);
+ }
+ finally
+ {
+ if (Directory.Exists(tempDir))
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+ }
+
+ [Fact]
+ public void ParentDirectoryIgnoreFile_AppliesToSubdirectories()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+ var subDir1 = Path.Combine(tempDir, "sub1");
+ var subDir2 = Path.Combine(tempDir, "sub1", "sub2");
+ Directory.CreateDirectory(subDir1);
+ Directory.CreateDirectory(subDir2);
+
+ try
+ {
+ // Put .ignore in root
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, "*.tmp");
+
+ var rule = new DotIgnoreIgnoreRule();
+
+ // Check file in sub2 - should find .ignore in parent
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(subDir2, "test.tmp"),
+ IsDirectory = false
+ };
+
+ var result = rule.ShouldIgnore(fileInfo, null);
+ Assert.True(result);
+
+ // Check file in sub1
+ var fileInfo2 = new FileSystemMetadata
+ {
+ FullName = Path.Combine(subDir1, "test.tmp"),
+ IsDirectory = false
+ };
+
+ var result2 = rule.ShouldIgnore(fileInfo2, null);
+ Assert.True(result2);
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
+
+ [Fact]
+ public void DirectoryMatching_TrailingSlashPattern()
+ {
+ var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
+ Directory.CreateDirectory(tempDir);
+ var subDir = Path.Combine(tempDir, "videos");
+ Directory.CreateDirectory(subDir);
+
+ try
+ {
+ var ignoreFilePath = Path.Combine(tempDir, ".ignore");
+ File.WriteAllText(ignoreFilePath, "videos/");
+
+ var rule = new DotIgnoreIgnoreRule();
+
+ // Directory should be ignored
+ var dirInfo = new FileSystemMetadata
+ {
+ FullName = subDir,
+ IsDirectory = true
+ };
+
+ var result = rule.ShouldIgnore(dirInfo, null);
+ Assert.True(result);
+
+ // File named "videos" should NOT be ignored (pattern has trailing slash)
+ var fileInfo = new FileSystemMetadata
+ {
+ FullName = Path.Combine(tempDir, "videos"),
+ IsDirectory = false
+ };
+
+ // Note: The Ignore library behavior may vary here, this tests the actual behavior
+ var resultFile = rule.ShouldIgnore(fileInfo, null);
+ // The file named "videos" without trailing slash might or might not match depending on the library
+ // This test documents the actual behavior
+ }
+ finally
+ {
+ Directory.Delete(tempDir, true);
+ }
+ }
}
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
index e60522bf78..acabaf3acb 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
@@ -22,7 +22,7 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
});
var countries = localizationManager.GetCountries().ToList();
- Assert.Equal(139, countries.Count);
+ Assert.Equal(140, countries.Count);
var germany = countries.FirstOrDefault(x => x.Name.Equals("DE", StringComparison.Ordinal));
Assert.NotNull(germany);
@@ -41,7 +41,7 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
await localizationManager.LoadAll();
var cultures = localizationManager.GetCultures().ToList();
- Assert.Equal(194, cultures.Count);
+ Assert.Equal(496, cultures.Count);
var germany = cultures.FirstOrDefault(x => x.TwoLetterISOLanguageName.Equals("de", StringComparison.Ordinal));
Assert.NotNull(germany);
@@ -99,6 +99,25 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
Assert.Contains("ger", germany.ThreeLetterISOLanguageNames);
}
+ [Theory]
+ [InlineData("mul", "Multiple languages")]
+ [InlineData("und", "Undetermined")]
+ [InlineData("mis", "Uncoded languages")]
+ [InlineData("zxx", "No linguistic content; Not applicable")]
+ public async Task FindLanguageInfo_ISO6392Only_Success(string code, string expectedDisplayName)
+ {
+ var localizationManager = Setup(new ServerConfiguration
+ {
+ UICulture = "en-US"
+ });
+ await localizationManager.LoadAll();
+
+ var culture = localizationManager.FindLanguageInfo(code);
+ Assert.NotNull(culture);
+ Assert.Equal(expectedDisplayName, culture.DisplayName);
+ Assert.Equal(code, culture.ThreeLetterISOLanguageName);
+ }
+
[Fact]
public async Task GetParentalRatings_Default_Success()
{
@@ -223,6 +242,40 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
}
[Theory]
+ [InlineData("US:INVALID", "US")] // Colon separator, known country code, unknown rating
+ [InlineData("us:INVALID", "US")] // Colon separator, lowercase country code
+ [InlineData("DE-INVALID", "US")] // Hyphen separator, known language prefix, unknown rating
+ [InlineData("ca:INVALID", "US")] // Colon separator, known country code (Canada)
+ public async Task GetRatingScore_UnknownRatingWithKnownCountry_ReturnsNull(string rating, string countryCode)
+ {
+ var localizationManager = Setup(new ServerConfiguration
+ {
+ MetadataCountryCode = countryCode
+ });
+ await localizationManager.LoadAll();
+
+ Assert.Null(localizationManager.GetRatingScore(rating));
+ }
+
+ [Theory]
+ [InlineData("us:R", "DE", 17, 0)] // Colon separator, explicit US country, valid US rating
+ [InlineData("US:PG-13", "DE", 13, 0)] // Colon separator, explicit US country, valid US rating
+ [InlineData("ca:R", "US", 18, 1)] // Colon separator, Canada country code, valid CA rating
+ public async Task GetRatingScore_ValidRatingWithCountrySeparator_ReturnsScore(string rating, string countryCode, int expectedScore, int? expectedSubScore)
+ {
+ var localizationManager = Setup(new ServerConfiguration
+ {
+ MetadataCountryCode = countryCode
+ });
+ await localizationManager.LoadAll();
+
+ var score = localizationManager.GetRatingScore(rating);
+ Assert.NotNull(score);
+ Assert.Equal(expectedScore, score.Score);
+ Assert.Equal(expectedSubScore, score.SubScore);
+ }
+
+ [Theory]
[InlineData("Default", "Default")]
[InlineData("HeaderLiveTV", "Live TV")]
public void GetLocalizedString_Valid_Success(string key, string expected)
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.cs
index 3d8ea15a31..ede9e61536 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.cs
@@ -192,13 +192,13 @@ namespace Jellyfin.Server.Implementations.Tests.Plugins
};
var metafilePath = Path.Combine(_pluginPath, "meta.json");
- await File.WriteAllTextAsync(metafilePath, JsonSerializer.Serialize(partial, _options));
+ await File.WriteAllTextAsync(metafilePath, JsonSerializer.Serialize(partial, _options), TestContext.Current.CancellationToken);
var pluginManager = new PluginManager(new NullLogger<PluginManager>(), null!, null!, _tempPath, new Version(1, 0));
await pluginManager.PopulateManifest(packageInfo, new Version(1, 0), _pluginPath, PluginStatus.Active);
- var resultBytes = await File.ReadAllBytesAsync(metafilePath);
+ var resultBytes = await File.ReadAllBytesAsync(metafilePath, TestContext.Current.CancellationToken);
var result = JsonSerializer.Deserialize<PluginManifest>(resultBytes, _options);
Assert.NotNull(result);
@@ -232,7 +232,7 @@ namespace Jellyfin.Server.Implementations.Tests.Plugins
await pluginManager.PopulateManifest(packageInfo, new Version(1, 0), _pluginPath, PluginStatus.Active);
var metafilePath = Path.Combine(_pluginPath, "meta.json");
- var resultBytes = await File.ReadAllBytesAsync(metafilePath);
+ var resultBytes = await File.ReadAllBytesAsync(metafilePath, TestContext.Current.CancellationToken);
var result = JsonSerializer.Deserialize<PluginManifest>(resultBytes, _options);
Assert.NotNull(result);
@@ -252,13 +252,13 @@ namespace Jellyfin.Server.Implementations.Tests.Plugins
};
var metafilePath = Path.Combine(_pluginPath, "meta.json");
- await File.WriteAllTextAsync(metafilePath, JsonSerializer.Serialize(partial, _options));
+ await File.WriteAllTextAsync(metafilePath, JsonSerializer.Serialize(partial, _options), TestContext.Current.CancellationToken);
var pluginManager = new PluginManager(new NullLogger<PluginManager>(), null!, null!, _tempPath, new Version(1, 0));
await pluginManager.PopulateManifest(packageInfo, new Version(1, 0), _pluginPath, PluginStatus.Active);
- var resultBytes = await File.ReadAllBytesAsync(metafilePath);
+ var resultBytes = await File.ReadAllBytesAsync(metafilePath, TestContext.Current.CancellationToken);
var result = JsonSerializer.Deserialize<PluginManifest>(resultBytes, _options);
Assert.NotNull(result);
@@ -278,13 +278,13 @@ namespace Jellyfin.Server.Implementations.Tests.Plugins
};
var metafilePath = Path.Combine(_pluginPath, "meta.json");
- await File.WriteAllTextAsync(metafilePath, JsonSerializer.Serialize(partial, _options));
+ await File.WriteAllTextAsync(metafilePath, JsonSerializer.Serialize(partial, _options), TestContext.Current.CancellationToken);
var pluginManager = new PluginManager(new NullLogger<PluginManager>(), null!, null!, _tempPath, new Version(1, 0));
await pluginManager.PopulateManifest(packageInfo, new Version(1, 0), _pluginPath, PluginStatus.Active);
- var resultBytes = await File.ReadAllBytesAsync(metafilePath);
+ var resultBytes = await File.ReadAllBytesAsync(metafilePath, TestContext.Current.CancellationToken);
var result = JsonSerializer.Deserialize<PluginManifest>(resultBytes, _options);
Assert.NotNull(result);
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs
index f58a3276ba..92e10c9f92 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Updates/InstallationManagerTests.cs
@@ -51,7 +51,8 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
PackageInfo[] packages = await _installationManager.GetPackages(
"Jellyfin Stable",
"https://repo.jellyfin.org/files/plugin/manifest.json",
- false);
+ false,
+ TestContext.Current.CancellationToken);
Assert.Equal(25, packages.Length);
}
@@ -62,7 +63,8 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
PackageInfo[] packages = await _installationManager.GetPackages(
"Jellyfin Stable",
"https://repo.jellyfin.org/files/plugin/manifest.json",
- false);
+ false,
+ TestContext.Current.CancellationToken);
packages = _installationManager.FilterPackages(packages, "Anime").ToArray();
Assert.Single(packages);
@@ -74,7 +76,8 @@ namespace Jellyfin.Server.Implementations.Tests.Updates
PackageInfo[] packages = await _installationManager.GetPackages(
"Jellyfin Stable",
"https://repo.jellyfin.org/files/plugin/manifest.json",
- false);
+ false,
+ TestContext.Current.CancellationToken);
packages = _installationManager.FilterPackages(packages, id: new Guid("a4df60c5-6ab4-412a-8f79-2cab93fb2bc5")).ToArray();
Assert.Single(packages);