mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
Fixed: Convert MonoOnly to PosixOnly
This commit is contained in:
parent
2b39865251
commit
5c07b39b04
@ -37,7 +37,7 @@ public void SetUp()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_use_verified_transfer_on_mono()
|
public void should_use_verified_transfer_on_mono()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
Subject.VerificationMode.Should().Be(DiskTransferVerificationMode.TryTransactional);
|
Subject.VerificationMode.Should().Be(DiskTransferVerificationMode.TryTransactional);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public void should_get_free_space_for_folder_that_doesnt_exist()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_be_able_to_check_space_on_ramdrive()
|
public void should_be_able_to_check_space_on_ramdrive()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
Subject.GetAvailableSpace("/run/").Should().NotBe(0);
|
Subject.GetAvailableSpace("/run/").Should().NotBe(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public void EnsureWindowsPath(string path)
|
|||||||
[TestCase(@"/var/user/file with, comma.mkv")]
|
[TestCase(@"/var/user/file with, comma.mkv")]
|
||||||
public void EnsureLinuxPath(string path)
|
public void EnsureLinuxPath(string path)
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
Ensure.That(path, () => path).IsValidPath();
|
Ensure.That(path, () => path).IsValidPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public void Clean_Path_Windows(string dirty, string clean)
|
|||||||
[TestCase(@"//CAPITAL//lower// ", @"/CAPITAL/lower")]
|
[TestCase(@"//CAPITAL//lower// ", @"/CAPITAL/lower")]
|
||||||
public void Clean_Path_Linux(string dirty, string clean)
|
public void Clean_Path_Linux(string dirty, string clean)
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
var result = dirty.CleanFilePath();
|
var result = dirty.CleanFilePath();
|
||||||
result.Should().Be(clean);
|
result.Should().Be(clean);
|
||||||
@ -152,14 +152,14 @@ public void path_should_return_parent_windows(string path, string parentPath)
|
|||||||
[TestCase(@"/test", "/")]
|
[TestCase(@"/test", "/")]
|
||||||
public void path_should_return_parent_mono(string path, string parentPath)
|
public void path_should_return_parent_mono(string path, string parentPath)
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
path.GetParentPath().Should().Be(parentPath);
|
path.GetParentPath().Should().Be(parentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void path_should_return_parent_for_oversized_path()
|
public void path_should_return_parent_for_oversized_path()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
// This test will fail on Windows if long path support is not enabled: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/
|
// This test will fail on Windows if long path support is not enabled: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/
|
||||||
// It will also fail if the app isn't configured to use long path (such as resharper): https://blogs.msdn.microsoft.com/jeremykuhne/2016/07/30/net-4-6-2-and-long-paths-on-windows-10/
|
// It will also fail if the app isn't configured to use long path (such as resharper): https://blogs.msdn.microsoft.com/jeremykuhne/2016/07/30/net-4-6-2-and-long-paths-on-windows-10/
|
||||||
@ -232,7 +232,7 @@ public void get_actual_casing_should_return_actual_casing_for_local_dir_in_windo
|
|||||||
[Test]
|
[Test]
|
||||||
public void get_actual_casing_should_return_original_value_in_linux()
|
public void get_actual_casing_should_return_original_value_in_linux()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
var path = Directory.GetCurrentDirectory();
|
var path = Directory.GetCurrentDirectory();
|
||||||
path.GetActualCasing().Should().Be(path);
|
path.GetActualCasing().Should().Be(path);
|
||||||
path.GetActualCasing().Should().Be(path);
|
path.GetActualCasing().Should().Be(path);
|
||||||
@ -306,7 +306,7 @@ public void GetAncestorFolders_should_return_all_ancestors_in_path_Windows()
|
|||||||
[Test]
|
[Test]
|
||||||
public void GetAncestorFolders_should_return_all_ancestors_in_path_Linux()
|
public void GetAncestorFolders_should_return_all_ancestors_in_path_Linux()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
var path = @"/Test/TV/Series Title";
|
var path = @"/Test/TV/Series Title";
|
||||||
var result = path.GetAncestorFolders();
|
var result = path.GetAncestorFolders();
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ private static bool InternalIsTesting()
|
|||||||
{
|
{
|
||||||
var currentAssemblyLocation = typeof(RuntimeInfo).Assembly.Location;
|
var currentAssemblyLocation = typeof(RuntimeInfo).Assembly.Location;
|
||||||
if (currentAssemblyLocation.ToLower().Contains("_output")) return true;
|
if (currentAssemblyLocation.ToLower().Contains("_output")) return true;
|
||||||
|
if (currentAssemblyLocation.ToLower().Contains("_tests")) return true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -148,6 +149,7 @@ private static bool InternalIsTesting()
|
|||||||
if (lowerCurrentDir.Contains("vsts")) return true;
|
if (lowerCurrentDir.Contains("vsts")) return true;
|
||||||
if (lowerCurrentDir.Contains("buildagent")) return true;
|
if (lowerCurrentDir.Contains("buildagent")) return true;
|
||||||
if (lowerCurrentDir.Contains("_output")) return true;
|
if (lowerCurrentDir.Contains("_output")) return true;
|
||||||
|
if (lowerCurrentDir.Contains("_tests")) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ public void should_warn_if_path_is_not_valid_for_windows()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_warn_if_path_is_not_valid_for_linux()
|
public void should_warn_if_path_is_not_valid_for_linux()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
_trackedDownload.DownloadItem.OutputPath = new OsPath(@"C:\Invalid\Mono\Path");
|
_trackedDownload.DownloadItem.OutputPath = new OsPath(@"C:\Invalid\Mono\Path");
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Core.HealthCheck.Checks;
|
using NzbDrone.Core.HealthCheck.Checks;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
@ -17,9 +18,12 @@ private void GivenHasStackFrame(bool hasStackFrame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_ok_if_windows()
|
public void should_return_ok_if_not_mono()
|
||||||
{
|
{
|
||||||
WindowsOnly();
|
if (PlatformInfo.IsMono)
|
||||||
|
{
|
||||||
|
throw new IgnoreException("non mono specific test");
|
||||||
|
}
|
||||||
|
|
||||||
Subject.Check().ShouldBeOk();
|
Subject.Check().ShouldBeOk();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public void should_return_error_when_app_folder_is_write_protected()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_error_when_app_folder_is_write_protected_and_update_automatically_is_enabled()
|
public void should_return_error_when_app_folder_is_write_protected_and_update_automatically_is_enabled()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
const string startupFolder = @"/opt/nzbdrone";
|
const string startupFolder = @"/opt/nzbdrone";
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ public void should_return_error_when_app_folder_is_write_protected_and_update_au
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_error_when_ui_folder_is_write_protected_and_update_automatically_is_enabled()
|
public void should_return_error_when_ui_folder_is_write_protected_and_update_automatically_is_enabled()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
const string startupFolder = @"/opt/nzbdrone";
|
const string startupFolder = @"/opt/nzbdrone";
|
||||||
const string uiFolder = @"/opt/nzbdrone/UI";
|
const string uiFolder = @"/opt/nzbdrone/UI";
|
||||||
@ -80,7 +80,7 @@ public void should_return_error_when_ui_folder_is_write_protected_and_update_aut
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_not_return_error_when_app_folder_is_write_protected_and_external_script_enabled()
|
public void should_not_return_error_when_app_folder_is_write_protected_and_external_script_enabled()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
Mocker.GetMock<IConfigFileProvider>()
|
Mocker.GetMock<IConfigFileProvider>()
|
||||||
.Setup(s => s.UpdateAutomatically)
|
.Setup(s => s.UpdateAutomatically)
|
||||||
|
@ -111,7 +111,7 @@ public void filter_should_return_none_existing_files_ignoring_case()
|
|||||||
[Test]
|
[Test]
|
||||||
public void filter_should_return_none_existing_files_not_ignoring_case()
|
public void filter_should_return_none_existing_files_not_ignoring_case()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
var files = new List<string>()
|
var files = new List<string>()
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ public void should_return_false_if_in_working_folder_and_last_write_time_was_rec
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_return_false_if_unopacking_on_linux()
|
public void should_return_false_if_unopacking_on_linux()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
GivenInWorkingFolder();
|
GivenInWorkingFolder();
|
||||||
GivenLastWriteTimeUtc(DateTime.UtcNow.AddDays(-5));
|
GivenLastWriteTimeUtc(DateTime.UtcNow.AddDays(-5));
|
||||||
|
@ -181,7 +181,7 @@ public void should_not_extract_if_verification_fails()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Platform("Mono")]
|
[Platform(Exclude="Win")]
|
||||||
public void should_run_script_if_configured()
|
public void should_run_script_if_configured()
|
||||||
{
|
{
|
||||||
const string scriptPath = "/tmp/nzbdrone/update.sh";
|
const string scriptPath = "/tmp/nzbdrone/update.sh";
|
||||||
@ -194,7 +194,7 @@ public void should_run_script_if_configured()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Platform("Mono")]
|
[Platform(Exclude="Win")]
|
||||||
public void should_throw_if_script_is_not_set()
|
public void should_throw_if_script_is_not_set()
|
||||||
{
|
{
|
||||||
const string scriptPath = "/tmp/nzbdrone/update.sh";
|
const string scriptPath = "/tmp/nzbdrone/update.sh";
|
||||||
@ -208,7 +208,7 @@ public void should_throw_if_script_is_not_set()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Platform("Mono")]
|
[Platform(Exclude="Win")]
|
||||||
public void should_throw_if_script_is_null()
|
public void should_throw_if_script_is_null()
|
||||||
{
|
{
|
||||||
const string scriptPath = "/tmp/nzbdrone/update.sh";
|
const string scriptPath = "/tmp/nzbdrone/update.sh";
|
||||||
@ -222,7 +222,7 @@ public void should_throw_if_script_is_null()
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Platform("Mono")]
|
[Platform(Exclude="Win")]
|
||||||
public void should_throw_if_script_path_does_not_exist()
|
public void should_throw_if_script_path_does_not_exist()
|
||||||
{
|
{
|
||||||
const string scriptPath = "/tmp/nzbdrone/update.sh";
|
const string scriptPath = "/tmp/nzbdrone/update.sh";
|
||||||
|
@ -51,7 +51,7 @@ public void should_not_be_valid_if_child_of_windows_folder()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_valid_if_set_to_bin_folder()
|
public void should_not_be_valid_if_set_to_bin_folder()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
var bin = OsInfo.IsOsx ? "/System" : "/bin";
|
var bin = OsInfo.IsOsx ? "/System" : "/bin";
|
||||||
var movie = Builder<Movie>.CreateNew()
|
var movie = Builder<Movie>.CreateNew()
|
||||||
@ -64,7 +64,7 @@ public void should_not_be_valid_if_set_to_bin_folder()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_valid_if_child_of_bin_folder()
|
public void should_not_be_valid_if_child_of_bin_folder()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
|
|
||||||
var bin = OsInfo.IsOsx ? "/System" : "/bin";
|
var bin = OsInfo.IsOsx ? "/System" : "/bin";
|
||||||
var movie = Builder<Movie>.CreateNew()
|
var movie = Builder<Movie>.CreateNew()
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
namespace NzbDrone.Mono.Test.DiskProviderTests
|
namespace NzbDrone.Mono.Test.DiskProviderTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
[Platform("Mono")]
|
[Platform(Exclude="Win")]
|
||||||
public class DiskProviderFixture : DiskProviderFixtureBase<DiskProvider>
|
public class DiskProviderFixture : DiskProviderFixtureBase<DiskProvider>
|
||||||
{
|
{
|
||||||
public DiskProviderFixture()
|
public DiskProviderFixture()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetWritePermissions(string path, bool writable)
|
protected override void SetWritePermissions(string path, bool writable)
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Test.DiskTests;
|
using NzbDrone.Common.Test.DiskTests;
|
||||||
using NzbDrone.Mono.Disk;
|
using NzbDrone.Mono.Disk;
|
||||||
|
|
||||||
namespace NzbDrone.Mono.Test.DiskProviderTests
|
namespace NzbDrone.Mono.Test.DiskProviderTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
[Platform("Mono")]
|
[Platform(Exclude="Win")]
|
||||||
public class FreeSpaceFixture : FreeSpaceFixtureBase<DiskProvider>
|
public class FreeSpaceFixture : FreeSpaceFixtureBase<DiskProvider>
|
||||||
{
|
{
|
||||||
public FreeSpaceFixture()
|
public FreeSpaceFixture()
|
||||||
{
|
{
|
||||||
MonoOnly();
|
PosixOnly();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,14 @@ protected void WindowsOnly()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void PosixOnly()
|
||||||
|
{
|
||||||
|
if (OsInfo.IsWindows)
|
||||||
|
{
|
||||||
|
throw new IgnoreException("non windows specific test");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void MonoOnly()
|
protected void MonoOnly()
|
||||||
{
|
{
|
||||||
if (!PlatformInfo.IsMono)
|
if (!PlatformInfo.IsMono)
|
||||||
|
Loading…
Reference in New Issue
Block a user