New: Even More Mono Cleaning

pull/6443/head
Qstick 3 years ago
parent cc572729ff
commit 92c4c50e1c

@ -20,7 +20,6 @@ class About extends Component {
packageVersion,
packageAuthor,
isNetCore,
isMono,
isDocker,
runtimeVersion,
migrationVersion,
@ -48,14 +47,6 @@ class About extends Component {
/>
}
{
isMono &&
<DescriptionListItem
title={translate('MonoVersion')}
data={runtimeVersion}
/>
}
{
isNetCore &&
<DescriptionListItem
@ -114,7 +105,6 @@ About.propTypes = {
packageVersion: PropTypes.string,
packageAuthor: PropTypes.string,
isNetCore: PropTypes.bool.isRequired,
isMono: PropTypes.bool.isRequired,
runtimeVersion: PropTypes.string.isRequired,
isDocker: PropTypes.bool.isRequired,
migrationVersion: PropTypes.number.isRequired,

@ -436,24 +436,6 @@ namespace NzbDrone.Common.Test.DiskTests
Assert.Throws<IOException>(() => Subject.TransferFolder(source.FullName, destination.FullName, TransferMode.Copy));
}
[Test]
public void CopyFolder_should_not_copy_casesensitive_folder()
{
MonoOnly();
WithRealDiskProvider();
var original = GetFilledTempFolder();
var root = new DirectoryInfo(GetTempFilePath());
var source = new DirectoryInfo(root.FullName + "A/series");
var destination = new DirectoryInfo(root.FullName + "A/Series");
Subject.TransferFolder(original.FullName, source.FullName, TransferMode.Copy);
// Note: Although technically possible top copy to different case, we're not allowing it
Assert.Throws<IOException>(() => Subject.TransferFolder(source.FullName, destination.FullName, TransferMode.Copy));
}
[Test]
public void CopyFolder_should_ignore_nfs_temp_file()
{
@ -539,26 +521,6 @@ namespace NzbDrone.Common.Test.DiskTests
source.FullName.GetActualCasing().Should().Be(destination.FullName);
}
[Test]
public void MoveFolder_should_rename_casesensitive_folder()
{
MonoOnly();
WithRealDiskProvider();
var original = GetFilledTempFolder();
var root = new DirectoryInfo(GetTempFilePath());
var source = new DirectoryInfo(root.FullName + "A/series");
var destination = new DirectoryInfo(root.FullName + "A/Series");
Subject.TransferFolder(original.FullName, source.FullName, TransferMode.Copy);
Subject.TransferFolder(source.FullName, destination.FullName, TransferMode.Move);
Directory.Exists(source.FullName).Should().Be(false);
Directory.Exists(destination.FullName).Should().Be(true);
}
[Test]
public void should_throw_if_destination_is_readonly()
{

@ -251,11 +251,6 @@ namespace NzbDrone.Common.Test.Http
[Test]
public void should_follow_redirects_to_https()
{
if (typeof(TDispatcher) == typeof(ManagedHttpDispatcher) && PlatformInfo.IsMono)
{
Assert.Ignore("Will fail on tls1.2 via managed dispatcher, ignore.");
}
var request = new HttpRequestBuilder($"https://{_httpBinHost}/redirect-to")
.AddQueryParam("url", $"https://radarr.video/")
.Build();

@ -170,7 +170,7 @@ namespace NzbDrone.Common.Test
var processStarted = new ManualResetEventSlim();
string suffix;
if (OsInfo.IsWindows || PlatformInfo.IsMono)
if (OsInfo.IsWindows)
{
suffix = ".exe";
}

@ -1,6 +1,4 @@
using System;
using System.Reflection;
using System.Text.RegularExpressions;
using System;
using Microsoft.Win32;
namespace NzbDrone.Common.EnvironmentInfo
@ -19,8 +17,6 @@ namespace NzbDrone.Common.EnvironmentInfo
public class PlatformInfo : IPlatformInfo
{
private static readonly Regex MonoVersionRegex = new Regex(@"(?<=\W|^)(?<version>\d+\.\d+(\.\d+)?(\.\d+)?)(?=\W)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static PlatformType _platform;
private static Version _version;
@ -31,7 +27,6 @@ namespace NzbDrone.Common.EnvironmentInfo
}
public static PlatformType Platform => _platform;
public static bool IsMono => Platform == PlatformType.Mono;
public static bool IsDotNet => Platform == PlatformType.DotNet;
public static bool IsNetCore => Platform == PlatformType.NetCore;
@ -43,10 +38,6 @@ namespace NzbDrone.Common.EnvironmentInfo
{
return ".NET";
}
else if (IsMono)
{
return "Mono";
}
else
{
return ".NET Core";
@ -61,35 +52,6 @@ namespace NzbDrone.Common.EnvironmentInfo
return _version;
}
private static Version GetMonoVersion()
{
try
{
var type = Type.GetType("Mono.Runtime");
if (type != null)
{
var displayNameMethod = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
if (displayNameMethod != null)
{
var displayName = displayNameMethod.Invoke(null, null).ToString();
var versionMatch = MonoVersionRegex.Match(displayName);
if (versionMatch.Success)
{
return new Version(versionMatch.Groups["version"].Value);
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Couldnt get Mono version: " + ex.ToString());
}
return new Version();
}
private static Version GetDotNetVersion()
{
try

@ -44,16 +44,6 @@ namespace NzbDrone.Common.Instrumentation
return;
}
if (PlatformInfo.IsMono)
{
if ((exception is TypeInitializationException && exception.InnerException is DllNotFoundException) ||
exception is DllNotFoundException)
{
Logger.Debug(exception, "Minor Fail: " + exception.Message);
return;
}
}
Console.WriteLine("EPIC FAIL: {0}", exception);
Logger.Fatal(exception, "EPIC FAIL.");
}

@ -106,13 +106,6 @@ namespace NzbDrone.Common.Instrumentation.Sentry
o.Debug = false;
o.DiagnosticsLevel = SentryLevel.Debug;
o.Release = BuildInfo.Release;
if (PlatformInfo.IsMono)
{
// Mono 6.0 broke GzipStream.WriteAsync
// TODO: Check specific version
o.RequestBodyCompressionLevel = System.IO.Compression.CompressionLevel.NoCompression;
}
o.BeforeSend = x => SentryCleanser.CleanseEvent(x);
o.BeforeBreadcrumb = x => SentryCleanser.CleanseBreadcrumb(x);
o.Environment = BuildInfo.Branch;
@ -154,14 +147,6 @@ namespace NzbDrone.Common.Instrumentation.Sentry
SentrySdk.ConfigureScope(scope =>
{
scope.SetTag("is_docker", $"{osInfo.IsDocker}");
if (osInfo.Name != null && PlatformInfo.IsMono)
{
// Sentry auto-detection of non-Windows platforms isn't that accurate on certain devices.
scope.Contexts.OperatingSystem.Name = osInfo.Name.FirstCharToUpper();
scope.Contexts.OperatingSystem.RawDescription = osInfo.FullName;
scope.Contexts.OperatingSystem.Version = osInfo.Version.ToString();
}
});
}

@ -366,11 +366,6 @@ namespace NzbDrone.Common.Processes
private (string Path, string Args) GetPathAndArgs(string path, string args)
{
if (PlatformInfo.IsMono && path.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase))
{
return ("mono", $"--debug {path} {args}");
}
if (OsInfo.IsWindows && path.EndsWith(".bat", StringComparison.InvariantCultureIgnoreCase))
{
return ("cmd.exe", $"/c {path} {args}");

@ -16,11 +16,6 @@ namespace NzbDrone.Core.Test.MediaCoverTests
[SetUp]
public void SetUp()
{
if (PlatformInfo.IsMono && PlatformInfo.GetVersion() < new Version(5, 8))
{
Assert.Inconclusive("Not supported on Mono < 5.8");
}
Mocker.GetMock<IDiskProvider>()
.Setup(v => v.FileExists(It.IsAny<string>()))
.Returns<string>(s => File.Exists(s));

@ -347,23 +347,6 @@ namespace NzbDrone.Core.Test.MediaFiles
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<MovieFile>(c => c.OriginalFilePath == $"{name}.mkv".AsOsAgnostic())));
}
[Test]
public void should_get_relative_path_when_there_is_no_grandparent_mono()
{
MonoOnly();
var name = "Transformers.2007.720p.BluRay.x264-Radarr";
var outputPath = "/";
var localMovie = _approvedDecisions.First().LocalMovie;
localMovie.FolderMovieInfo = new ParsedMovieInfo { ReleaseTitle = name };
localMovie.Path = Path.Combine(outputPath, name + ".mkv");
Subject.Import(new List<ImportDecision> { _approvedDecisions.First() }, true, null);
Mocker.GetMock<IMediaFileService>().Verify(v => v.Add(It.Is<MovieFile>(c => c.OriginalFilePath == $"{name}.mkv".AsOsAgnostic())));
}
[Test]
public void should_get_relative_path_when_there_is_no_grandparent_for_UNC_path()
{

@ -21,12 +21,6 @@ namespace NzbDrone.Core.MediaCover
{
_diskProvider = diskProvider;
// Random segfaults on mono 5.0 and 5.4
if (PlatformInfo.IsMono && platformInfo.Version < new System.Version(5, 8))
{
return;
}
_enabled = true;
// More conservative memory allocation

@ -11,8 +11,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Order(0)]
public void add_downloadclient_without_name_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoDownloadClient();
var schema = DownloadClients.Schema().First(v => v.Implementation == "UsenetBlackhole");
@ -28,8 +26,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Order(0)]
public void add_downloadclient_without_nzbfolder_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoDownloadClient();
var schema = DownloadClients.Schema().First(v => v.Implementation == "UsenetBlackhole");
@ -45,8 +41,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Order(0)]
public void add_downloadclient_without_watchfolder_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoDownloadClient();
var schema = DownloadClients.Schema().First(v => v.Implementation == "UsenetBlackhole");
@ -101,8 +95,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void get_downloadclient_by_unknown_id_should_return_404()
{
IgnoreOnMonoVersions("5.12", "5.14");
var result = DownloadClients.InvalidGet(1000000);
}

@ -33,8 +33,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Order(0)]
public void add_movie_without_profileid_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoMovie(680, "Pulp Fiction");
var movie = Movies.Lookup("imdb:tt0110912").Single();
@ -48,8 +46,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Order(0)]
public void add_movie_without_path_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoMovie(680, "Pulp Fiction");
var movie = Movies.Lookup("imdb:tt0110912").Single();
@ -126,8 +122,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void get_movie_by_unknown_id_should_return_404()
{
IgnoreOnMonoVersions("5.12", "5.14");
var result = Movies.InvalidGet(1000000);
}

@ -35,8 +35,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_standard_format_is_empty()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = true;
config.StandardMovieFormat = "";
@ -48,8 +46,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_standard_format_doesnt_contain_title()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = true;
config.StandardMovieFormat = "{quality}";
@ -61,8 +57,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_not_require_format_when_rename_episodes_is_false()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = false;
config.StandardMovieFormat = "";
@ -74,8 +68,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_require_format_when_rename_episodes_is_true()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = true;
config.StandardMovieFormat = "";
@ -87,8 +79,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_movie_folder_format_does_not_contain_movie_title()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameMovies = true;
config.MovieFolderFormat = "This and That";

@ -42,8 +42,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void invalid_path_should_return_bad_request()
{
IgnoreOnMonoVersions("5.12", "5.14");
var rootFolder = new RootFolderResource
{
Path = "invalid_path"

@ -1,4 +1,4 @@
using System.Net;
using System.Net;
using FluentAssertions;
using NUnit.Framework;
using RestSharp;
@ -33,8 +33,6 @@ namespace NzbDrone.Integration.Test
[TestCase("application/junk")]
public void should_get_unacceptable_with_accept_header(string header)
{
IgnoreOnMonoVersions("5.12", "5.14");
var request = new RestRequest("system/status")
{
RequestFormat = DataFormat.None

@ -11,8 +11,6 @@ namespace NzbDrone.Integration.Test
[Test]
public void should_log_on_error()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = HostConfig.Get(1);
config.LogLevel = "Trace";
HostConfig.Put(config);

@ -155,22 +155,6 @@ namespace NzbDrone.Integration.Test
}
}
protected void IgnoreOnMonoVersions(params string[] version_strings)
{
if (!PlatformInfo.IsMono)
{
return;
}
var current = PlatformInfo.GetVersion();
var versions = version_strings.Select(x => new Version(x)).ToList();
if (versions.Any(x => x.Major == current.Major && x.Minor == current.Minor))
{
throw new IgnoreException($"Ignored on mono {PlatformInfo.GetVersion()}");
}
}
public string GetTempDirectory(params string[] args)
{
var path = Path.Combine(TempDirectory, Path.Combine(args));

@ -10,11 +10,6 @@ namespace NzbDrone.Mono.Test.DiskProviderTests
[Platform(Exclude = "Win")]
public class FreeSpaceFixture : FreeSpaceFixtureBase<DiskProvider>
{
public FreeSpaceFixture()
{
PosixOnly();
}
[SetUp]
public void Setup()
{

@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using Mono.Posix;
using Mono.Unix;
using NUnit.Framework;
using NzbDrone.Mono.Disk;
@ -14,14 +8,9 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Mono.Test.DiskProviderTests
{
[TestFixture]
[Platform("Mono")]
[Platform(Exclude = "Win")]
public class SymbolicLinkResolverFixture : TestBase<SymbolicLinkResolver>
{
public SymbolicLinkResolverFixture()
{
MonoOnly();
}
[Test]
public void should_follow_nested_symlinks()
{

@ -44,10 +44,6 @@ namespace NzbDrone.Test.Common
{
consoleExe = "Radarr.Console.exe";
}
else if (PlatformInfo.IsMono)
{
consoleExe = "Radarr.exe";
}
else
{
consoleExe = "Radarr";

@ -166,14 +166,6 @@ namespace NzbDrone.Test.Common
}
}
protected void MonoOnly()
{
if (!PlatformInfo.IsMono)
{
throw new IgnoreException("mono specific test");
}
}
protected void NotBsd()
{
if (OsInfo.Os == Os.Bsd)

@ -61,7 +61,6 @@ namespace Radarr.Api.V3.System
OsName = _osInfo.Name,
OsVersion = _osInfo.Version,
IsNetCore = PlatformInfo.IsNetCore,
IsMono = PlatformInfo.IsMono,
IsLinux = OsInfo.IsLinux,
IsOsx = OsInfo.IsOsx,
IsWindows = OsInfo.IsWindows,

@ -1,11 +1,10 @@
using System;
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
using Nancy;
using Nancy.Bootstrapper;
using NLog;
using NzbDrone.Common.EnvironmentInfo;
namespace Radarr.Http.Extensions.Pipelines
{
@ -21,8 +20,7 @@ namespace Radarr.Http.Extensions.Pipelines
{
_logger = logger;
// On Mono GZipStream/DeflateStream leaks memory if an exception is thrown, use an intermediate buffer in that case.
_writeGZipStream = PlatformInfo.IsMono ? WriteGZipStreamMono : (Action<Action<Stream>, Stream>)WriteGZipStream;
_writeGZipStream = (Action<Action<Stream>, Stream>)WriteGZipStream;
}
public void Register(IPipelines pipelines)

Loading…
Cancel
Save