1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Upgraded mono version check (3.10 minimum and 4.4.x)

New: Health warning if mono version is less than 3.10
New: Health error if running mono 4.4.x
This commit is contained in:
Mark McDowall 2016-09-26 18:47:33 -07:00
parent 9fae76015a
commit e0d1e08f94
2 changed files with 37 additions and 68 deletions

View File

@ -1,5 +1,4 @@
using System;
using NUnit.Framework;
using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Test.Framework;
@ -22,76 +21,40 @@ private void GivenOutput(string version)
.Returns(string.Format("{0} (tarball Wed Sep 25 16:35:44 CDT 2013)", version));
}
[Test]
public void should_return_warning_when_mono_3_0()
[TestCase("3.10")]
[TestCase("4.0.0.0")]
[TestCase("4.2")]
[TestCase("4.6")]
public void should_return_ok(string version)
{
GivenOutput("3.0.0.1");
GivenOutput(version);
Subject.Check().ShouldBeOk();
}
[TestCase("2.10.2")]
[TestCase("2.10.8.1")]
[TestCase("3.0.0.1")]
[TestCase("3.2.0.1")]
[TestCase("3.2.1")]
[TestCase("3.2.7")]
[TestCase("3.6.1")]
[TestCase("3.8")]
public void should_return_warning(string version)
{
GivenOutput(version);
Subject.Check().ShouldBeWarning();
}
[Test]
public void should_return_warning_when_mono_2_10_8()
[TestCase("4.4.0")]
[TestCase("4.4.1")]
public void should_return_error(string version)
{
GivenOutput("2.10.8.1");
GivenOutput(version);
Subject.Check().ShouldBeWarning();
}
[Test]
public void should_return_warning_when_mono_2_10_2()
{
GivenOutput("2.10.2");
Subject.Check().ShouldBeWarning();
}
[Test]
public void should_return_ok_when_mono_3_2()
{
GivenOutput("3.2.0.1");
Subject.Check().ShouldBeOk();
}
[Test]
public void should_return_ok_when_mono_4_0()
{
GivenOutput("4.0.0.0");
Subject.Check().ShouldBeOk();
}
[Test]
public void should_return_ok_when_mono_3_2_7()
{
GivenOutput("3.2.7");
Subject.Check().ShouldBeOk();
}
[Test]
public void should_return_ok_when_mono_3_2_1()
{
GivenOutput("3.2.1");
Subject.Check().ShouldBeOk();
}
[Test]
public void should_return_ok_when_mono_3_6_1()
{
GivenOutput("3.6.1");
Subject.Check().ShouldBeOk();
}
[Test]
public void should_return_ok_when_mono_3_10()
{
GivenOutput("3.10");
Subject.Check().ShouldBeOk();
Subject.Check().ShouldBeError();
}
}
}

View File

@ -39,14 +39,20 @@ public override HealthCheck Check()
return new HealthCheck(GetType(), HealthCheckResult.Error, "your mono version 3.4.0 has a critical bug, you should upgrade to a higher version");
}
if (version >= new Version(3, 2))
if (version >= new Version(4, 4, 0) && version < new Version(4, 5))
{
_logger.Debug("mono version is 3.2 or better: {0}", version.ToString());
_logger.Debug("mono version {0}", version);
return new HealthCheck(GetType(), HealthCheckResult.Error, $"your mono version {version} has a bug that causes issues connecting to indexers/download clients");
}
if (version >= new Version(3, 10))
{
_logger.Debug("mono version is 3.10 or better: {0}", version.ToString());
return new HealthCheck(GetType());
}
}
return new HealthCheck(GetType(), HealthCheckResult.Warning, "mono version is less than 3.2, upgrade for improved stability");
return new HealthCheck(GetType(), HealthCheckResult.Warning, "mono version is less than 3.10, upgrade for improved stability");
}
public override bool CheckOnConfigChange