1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Prompt upgrade to mono version on DSM and FreeBSD

This commit is contained in:
ta264 2021-03-21 21:06:13 +00:00 committed by Qstick
parent e9ece8a319
commit cc466b9e5b
2 changed files with 21 additions and 16 deletions

View File

@ -25,7 +25,23 @@ public void should_log_warning_if_mono()
[Test] [Test]
[Platform("Mono")] [Platform("Mono")]
public void should_return_ok_if_bsd() public void should_return_ok_if_otherbsd()
{
Mocker.GetMock<IProcessProvider>()
.Setup(x => x.StartAndCapture("uname", null, null))
.Returns(new ProcessOutput
{
Lines = new List<ProcessOutputLine>
{
new ProcessOutputLine(ProcessOutputLevel.Standard, "OpenBSD")
}
});
Subject.Check().ShouldBeOk();
}
[Test]
[Platform("Mono")]
public void should_log_warning_if_freebsd()
{ {
Mocker.GetMock<IProcessProvider>() Mocker.GetMock<IProcessProvider>()
.Setup(x => x.StartAndCapture("uname", null, null)) .Setup(x => x.StartAndCapture("uname", null, null))
@ -36,7 +52,7 @@ public void should_return_ok_if_bsd()
new ProcessOutputLine(ProcessOutputLevel.Standard, "FreeBSD") new ProcessOutputLine(ProcessOutputLevel.Standard, "FreeBSD")
} }
}); });
Subject.Check().ShouldBeOk(); Subject.Check().ShouldBeWarning();
} }
} }
} }

View File

@ -1,6 +1,5 @@
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using NLog;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Processes; using NzbDrone.Common.Processes;
using NzbDrone.Core.Localization; using NzbDrone.Core.Localization;
@ -9,17 +8,13 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
public class MonoNotNetCoreCheck : HealthCheckBase public class MonoNotNetCoreCheck : HealthCheckBase
{ {
private static string[] MonoUnames = new string[] { "FreeBSD", "OpenBSD", "MidnightBSD", "NetBSD" }; private static string[] MonoUnames = new string[] { "OpenBSD", "MidnightBSD", "NetBSD" };
private readonly IOsInfo _osInfo;
private readonly IProcessProvider _processProvider; private readonly IProcessProvider _processProvider;
public MonoNotNetCoreCheck(IOsInfo osInfo, public MonoNotNetCoreCheck(IProcessProvider processProvider,
IProcessProvider processProvider, ILocalizationService localizationService)
ILocalizationService localizationService,
Logger logger)
: base(localizationService) : base(localizationService)
{ {
_osInfo = osInfo;
_processProvider = processProvider; _processProvider = processProvider;
} }
@ -30,12 +25,6 @@ public override HealthCheck Check()
return new HealthCheck(GetType()); return new HealthCheck(GetType());
} }
// Don't warn on arm based synology - could be arm5 or something else rubbish
if (_osInfo.Name == "DSM" && RuntimeInformation.ProcessArchitecture == Architecture.Arm)
{
return new HealthCheck(GetType());
}
// Don't warn on linux x86 - we don't build x86 net core // Don't warn on linux x86 - we don't build x86 net core
if (OsInfo.IsLinux && RuntimeInformation.ProcessArchitecture == Architecture.X86) if (OsInfo.IsLinux && RuntimeInformation.ProcessArchitecture == Architecture.X86)
{ {