New: Even More Mono Cleaning

pull/2307/head
Qstick 3 years ago
parent 2cc114c037
commit 57bd659f4c

@ -19,7 +19,6 @@ class About extends Component {
packageVersion,
packageAuthor,
isNetCore,
isMono,
isDocker,
runtimeVersion,
migrationVersion,
@ -47,14 +46,6 @@ class About extends Component {
/>
}
{
isMono &&
<DescriptionListItem
title="Mono Version"
data={runtimeVersion}
/>
}
{
isNetCore &&
<DescriptionListItem
@ -113,7 +104,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,

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

@ -21,8 +21,7 @@ namespace Lidarr.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)

@ -437,24 +437,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()
{
@ -540,26 +522,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://lidarr.audio/")
.Build();

@ -172,7 +172,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

@ -38,16 +38,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.");
}

@ -109,13 +109,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;
@ -157,14 +150,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));

@ -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

@ -34,8 +34,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Order(0)]
public void add_artist_without_profileid_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoArtist("f59c5520-5f46-4d2c-b2c4-822eabf53419", "Linkin Park");
var artist = Artist.Lookup("lidarr:f59c5520-5f46-4d2c-b2c4-822eabf53419").Single();
@ -49,8 +47,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Order(0)]
public void add_artist_without_path_should_return_badrequest()
{
IgnoreOnMonoVersions("5.12", "5.14");
EnsureNoArtist("f59c5520-5f46-4d2c-b2c4-822eabf53419", "Linkin Park");
var artist = Artist.Lookup("lidarr:f59c5520-5f46-4d2c-b2c4-822eabf53419").Single();
@ -109,8 +105,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void get_artist_by_unknown_id_should_return_404()
{
IgnoreOnMonoVersions("5.12", "5.14");
var result = Artist.InvalidGet(1000000);
}
@ -141,18 +135,11 @@ namespace NzbDrone.Integration.Test.ApiTests
artist.Monitored.Should().BeFalse();
//artist.Seasons.First().Monitored.Should().BeFalse();
artist.Monitored = true;
//artist.Seasons.ForEach(season =>
//{
// season.Monitored = true;
//});
var result = Artist.Put(artist);
result.Monitored.Should().BeTrue();
//result.Seasons.First().Monitored.Should().BeTrue();
}
[Test]

@ -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);
}

@ -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.RenameTracks = true;
config.StandardTrackFormat = "";
@ -48,8 +46,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_standard_format_doesnt_contain_track_number_and_title()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameTracks = true;
config.StandardTrackFormat = "{track:00}";
@ -61,8 +57,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_not_require_format_when_rename_tracks_is_false()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameTracks = false;
config.StandardTrackFormat = "";
@ -74,8 +68,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_require_format_when_rename_tracks_is_true()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameTracks = true;
config.StandardTrackFormat = "";
@ -87,8 +79,6 @@ namespace NzbDrone.Integration.Test.ApiTests
[Test]
public void should_get_bad_request_if_artist_folder_format_does_not_contain_artist_name()
{
IgnoreOnMonoVersions("5.12", "5.14");
var config = NamingConfig.GetSingle();
config.RenameTracks = true;
config.ArtistFolderFormat = "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);

@ -163,22 +163,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()
{
MonoOnly();
}
[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()
{

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

@ -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)

Loading…
Cancel
Save