mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
New: Check SQLite is at least version 3.9.0
This commit is contained in:
parent
8428de7a00
commit
7754589353
@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
using NzbDrone.Core.HealthCheck.Checks;
|
||||||
|
using NzbDrone.Core.Localization;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class SqliteVersionCheckFixture : CoreTest<SqliteVersionCheck>
|
||||||
|
{
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
Mocker.GetMock<ILocalizationService>()
|
||||||
|
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
|
||||||
|
.Returns("Some Warning Message");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GivenOutput(string version)
|
||||||
|
{
|
||||||
|
if (!OsInfo.IsLinux)
|
||||||
|
{
|
||||||
|
throw new IgnoreException("linux specific test");
|
||||||
|
}
|
||||||
|
|
||||||
|
Mocker.GetMock<IMainDatabase>()
|
||||||
|
.SetupGet(s => s.Version)
|
||||||
|
.Returns(new Version(version));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("3.9.0")]
|
||||||
|
[TestCase("3.9.1")]
|
||||||
|
[TestCase("3.26.0")]
|
||||||
|
[TestCase("3.34.0")]
|
||||||
|
public void should_return_ok(string version)
|
||||||
|
{
|
||||||
|
GivenOutput(version);
|
||||||
|
|
||||||
|
Subject.Check().ShouldBeOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("3.8.11.1")]
|
||||||
|
[TestCase("3.8.11")]
|
||||||
|
[TestCase("3.3.9")]
|
||||||
|
[TestCase("2.8.12")]
|
||||||
|
public void should_return_error(string version)
|
||||||
|
{
|
||||||
|
GivenOutput(version);
|
||||||
|
|
||||||
|
Subject.Check().ShouldBeError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
src/NzbDrone.Core/HealthCheck/Checks/SqliteVersionCheck.cs
Normal file
44
src/NzbDrone.Core/HealthCheck/Checks/SqliteVersionCheck.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using NLog;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
using NzbDrone.Core.Localization;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
|
{
|
||||||
|
public class SqliteVersionCheck : HealthCheckBase
|
||||||
|
{
|
||||||
|
private readonly IDatabase _database;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
|
public SqliteVersionCheck(IMainDatabase database, ILocalizationService localizationService, Logger logger)
|
||||||
|
: base(localizationService)
|
||||||
|
{
|
||||||
|
_database = database;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override HealthCheck Check()
|
||||||
|
{
|
||||||
|
if (!OsInfo.IsLinux)
|
||||||
|
{
|
||||||
|
return new HealthCheck(GetType());
|
||||||
|
}
|
||||||
|
|
||||||
|
var sqliteVersion = _database.Version;
|
||||||
|
var supportedVersion = new Version("3.9.0");
|
||||||
|
|
||||||
|
if (sqliteVersion >= supportedVersion)
|
||||||
|
{
|
||||||
|
return new HealthCheck(GetType());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HealthCheck(GetType(),
|
||||||
|
HealthCheckResult.Error,
|
||||||
|
string.Format(_localizationService.GetLocalizedString("SqliteVersionCheckUpgradeRequiredMessage"), sqliteVersion, supportedVersion),
|
||||||
|
"#currently_installed_sqlite_version_is_not_supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CheckOnSchedule => false;
|
||||||
|
}
|
||||||
|
}
|
@ -894,6 +894,7 @@
|
|||||||
"SourcePath": "Source Path",
|
"SourcePath": "Source Path",
|
||||||
"SourceRelativePath": "Source Relative Path",
|
"SourceRelativePath": "Source Relative Path",
|
||||||
"SourceTitle": "Source Title",
|
"SourceTitle": "Source Title",
|
||||||
|
"SqliteVersionCheckUpgradeRequiredMessage": "Currently installed SQLite version {0} is no longer supported. Please upgrade SQLite to at least version {1}.",
|
||||||
"SSLCertPassword": "SSL Cert Password",
|
"SSLCertPassword": "SSL Cert Password",
|
||||||
"SSLCertPasswordHelpText": "Password for pfx file",
|
"SSLCertPasswordHelpText": "Password for pfx file",
|
||||||
"SSLCertPath": "SSL Cert Path",
|
"SSLCertPath": "SSL Cert Path",
|
||||||
|
Loading…
Reference in New Issue
Block a user