mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
Fixed: Version check for SABnzbd develop
This commit is contained in:
parent
080e2e9eff
commit
bf8d68a873
2 changed files with 44 additions and 5 deletions
|
@ -12,6 +12,7 @@
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
using NzbDrone.Core.RemotePathMappings;
|
using NzbDrone.Core.RemotePathMappings;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
|
using NzbDrone.Core.Validation;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||||
{
|
{
|
||||||
|
@ -436,5 +437,18 @@ public void should_test_version(string version, bool expected)
|
||||||
|
|
||||||
error.IsValid.Should().Be(expected);
|
error.IsValid.Should().Be(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_test_develop_version_successfully()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<ISabnzbdProxy>()
|
||||||
|
.Setup(v => v.GetVersion(It.IsAny<SabnzbdSettings>()))
|
||||||
|
.Returns("develop");
|
||||||
|
|
||||||
|
var result = new NzbDroneValidationResult(Subject.Test());
|
||||||
|
|
||||||
|
result.IsValid.Should().BeTrue();
|
||||||
|
result.HasWarnings.Should().BeTrue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,15 +280,31 @@ private bool HasVersion(int major, int minor, int patch = 0, string candidate =
|
||||||
var version = _proxy.GetVersion(Settings);
|
var version = _proxy.GetVersion(Settings);
|
||||||
var parsed = VersionRegex.Match(version);
|
var parsed = VersionRegex.Match(version);
|
||||||
|
|
||||||
|
int actualMajor;
|
||||||
|
int actualMinor;
|
||||||
|
int actualPatch;
|
||||||
|
string actualCandidate;
|
||||||
|
|
||||||
if (!parsed.Success)
|
if (!parsed.Success)
|
||||||
|
{
|
||||||
|
if (!version.Equals("develop", StringComparison.InvariantCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var actualMajor = Convert.ToInt32(parsed.Groups["major"].Value);
|
actualMajor = 1;
|
||||||
var actualMinor = Convert.ToInt32(parsed.Groups["minor"].Value);
|
actualMinor = 1;
|
||||||
var actualPatch = Convert.ToInt32(parsed.Groups["patch"].Value.Replace("x", ""));
|
actualPatch = 0;
|
||||||
var actualCandidate = parsed.Groups["candidate"].Value.ToUpper();
|
actualCandidate = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
actualMajor = Convert.ToInt32(parsed.Groups["major"].Value);
|
||||||
|
actualMinor = Convert.ToInt32(parsed.Groups["minor"].Value);
|
||||||
|
actualPatch = Convert.ToInt32(parsed.Groups["patch"].Value.Replace("x", ""));
|
||||||
|
actualCandidate = parsed.Groups["candidate"].Value.ToUpper();
|
||||||
|
}
|
||||||
|
|
||||||
if (actualMajor > major)
|
if (actualMajor > major)
|
||||||
{
|
{
|
||||||
|
@ -340,6 +356,15 @@ private ValidationFailure TestConnectionAndVersion()
|
||||||
|
|
||||||
if (!parsed.Success)
|
if (!parsed.Success)
|
||||||
{
|
{
|
||||||
|
if (version.Equals("develop", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
return new NzbDroneValidationFailure("Version", "Sabnzbd develop version, assuming version 1.1.0 or higher.")
|
||||||
|
{
|
||||||
|
IsWarning = true,
|
||||||
|
DetailedDescription = "Sonarr may not be able to support new features added to SABnzbd when running develop versions."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return new ValidationFailure("Version", "Unknown Version: " + version);
|
return new ValidationFailure("Version", "Unknown Version: " + version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue