New: Various Healthcheck enhancements

Various pulls from Radarr;  Completed at the file - not commit - level
pull/1462/head
bakerboy448 3 years ago committed by GitHub
parent c5787b0c87
commit 24e2ff56dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,8 @@
using NUnit.Framework; using Moq;
using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
@ -9,6 +11,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class AppDataLocationFixture : CoreTest<AppDataLocationCheck> public class AppDataLocationFixture : CoreTest<AppDataLocationCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
[Test] [Test]
public void should_return_warning_when_app_data_is_child_of_startup_folder() public void should_return_warning_when_app_data_is_child_of_startup_folder()
{ {

@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -10,12 +12,20 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class DownloadClientCheckFixture : CoreTest<DownloadClientCheck> public class DownloadClientCheckFixture : CoreTest<DownloadClientCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
[Test] [Test]
public void should_return_warning_when_download_client_has_not_been_configured() public void should_return_warning_when_download_client_has_not_been_configured()
{ {
Mocker.GetMock<IProvideDownloadClient>() Mocker.GetMock<IProvideDownloadClient>()
.Setup(s => s.GetDownloadClients()) .Setup(s => s.GetDownloadClients())
.Returns(new IDownloadClient[0]); .Returns(Array.Empty<IDownloadClient>());
Subject.Check().ShouldBeWarning(); Subject.Check().ShouldBeWarning();
} }

@ -31,6 +31,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
_clientStatus = new DownloadClientInfo _clientStatus = new DownloadClientInfo
{ {
IsLocalhost = true, IsLocalhost = true,
@ -44,10 +48,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
_downloadClient.Setup(s => s.GetStatus()) _downloadClient.Setup(s => s.GetStatus())
.Returns(_clientStatus); .Returns(_clientStatus);
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
Mocker.GetMock<IProvideDownloadClient>() Mocker.GetMock<IProvideDownloadClient>()
.Setup(s => s.GetDownloadClients()) .Setup(s => s.GetDownloadClients())
.Returns(new IDownloadClient[] { _downloadClient.Object }); .Returns(new IDownloadClient[] { _downloadClient.Object });

@ -1,4 +1,4 @@
using FluentAssertions; using FluentAssertions;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.HealthCheck; using NzbDrone.Core.HealthCheck;
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
if (wikiFragment.IsNotNullOrWhiteSpace()) if (wikiFragment.IsNotNullOrWhiteSpace())
{ {
result.WikiUrl.Fragment.Should().Be(wikiFragment); result.WikiUrl.ToString().Should().Contain(wikiFragment);
} }
} }
@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
if (wikiFragment.IsNotNullOrWhiteSpace()) if (wikiFragment.IsNotNullOrWhiteSpace())
{ {
result.WikiUrl.Fragment.Should().Be(wikiFragment); result.WikiUrl.ToString().Should().Contain(wikiFragment);
} }
} }
} }

@ -4,6 +4,7 @@ using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.ImportLists; using NzbDrone.Core.ImportLists;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -24,6 +25,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Mocker.GetMock<IImportListStatusService>() Mocker.GetMock<IImportListStatusService>()
.Setup(v => v.GetBlockedProviders()) .Setup(v => v.GetBlockedProviders())
.Returns(_blockedImportLists); .Returns(_blockedImportLists);
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private Mock<IImportList> GivenImportList(int i, double backoffHours, double failureHours) private Mock<IImportList> GivenImportList(int i, double backoffHours, double failureHours)

@ -1,6 +1,8 @@
using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -8,6 +10,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class ImportMechanismCheckFixture : CoreTest<ImportMechanismCheck> public class ImportMechanismCheckFixture : CoreTest<ImportMechanismCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
private void GivenCompletedDownloadHandling(bool? enabled = null) private void GivenCompletedDownloadHandling(bool? enabled = null)
{ {
if (enabled.HasValue) if (enabled.HasValue)
@ -19,7 +29,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_return_warning_when_completeddownloadhandling_false() public void should_return_warning_when_completed_download_handling_not_configured()
{ {
GivenCompletedDownloadHandling(false); GivenCompletedDownloadHandling(false);

@ -4,6 +4,7 @@ using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -24,6 +25,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Mocker.GetMock<IIndexerStatusService>() Mocker.GetMock<IIndexerStatusService>()
.Setup(v => v.GetBlockedProviders()) .Setup(v => v.GetBlockedProviders())
.Returns(_blockedIndexers); .Returns(_blockedIndexers);
Mocker.GetMock<ILocalizationService>()
.Setup(v => v.GetLocalizedString(It.IsAny<string>()))
.Returns("Error");
} }
private Mock<IIndexer> GivenIndexer(int id, double backoffHours, double failureHours) private Mock<IIndexer> GivenIndexer(int id, double backoffHours, double failureHours)

@ -1,8 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -22,6 +23,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Mocker.GetMock<IIndexerFactory>() Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.RssEnabled(It.IsAny<bool>())) .Setup(s => s.RssEnabled(It.IsAny<bool>()))
.Returns(new List<IIndexer>()); .Returns(new List<IIndexer>());
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private void GivenIndexer(bool supportsRss, bool supportsSearch) private void GivenIndexer(bool supportsRss, bool supportsSearch)
@ -47,6 +52,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Mocker.GetMock<IIndexerFactory>() Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.RssEnabled(false)) .Setup(s => s.RssEnabled(false))
.Returns(new List<IIndexer> { _indexerMock.Object }); .Returns(new List<IIndexer> { _indexerMock.Object });
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("recent indexer errors");
} }
[Test] [Test]

@ -3,6 +3,7 @@ using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -26,6 +27,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Mocker.GetMock<IIndexerFactory>() Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.InteractiveSearchEnabled(It.IsAny<bool>())) .Setup(s => s.InteractiveSearchEnabled(It.IsAny<bool>()))
.Returns(new List<IIndexer>()); .Returns(new List<IIndexer>());
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private void GivenIndexer(bool supportsRss, bool supportsSearch) private void GivenIndexer(bool supportsRss, bool supportsSearch)
@ -62,6 +67,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Mocker.GetMock<IIndexerFactory>() Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.InteractiveSearchEnabled(false)) .Setup(s => s.InteractiveSearchEnabled(false))
.Returns(new List<IIndexer> { _indexerMock.Object }); .Returns(new List<IIndexer> { _indexerMock.Object });
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("recent indexer errors");
} }
[Test] [Test]

@ -4,6 +4,7 @@ using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -24,6 +25,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Mocker.GetMock<IIndexerStatusService>() Mocker.GetMock<IIndexerStatusService>()
.Setup(v => v.GetBlockedProviders()) .Setup(v => v.GetBlockedProviders())
.Returns(_blockedIndexers); .Returns(_blockedIndexers);
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private Mock<IIndexer> GivenIndexer(int i, double backoffHours, double failureHours) private Mock<IIndexer> GivenIndexer(int i, double backoffHours, double failureHours)

@ -10,7 +10,7 @@ using NzbDrone.Core.Configuration;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Download.Clients; using NzbDrone.Core.Download.Clients;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Localization;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
@ -41,12 +41,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
{ {
_downloadItem = new DownloadClientItem _downloadItem = new DownloadClientItem
{ {
DownloadClientInfo = new DownloadClientItemClientInfo DownloadClientInfo = new DownloadClientItemClientInfo { Name = "Test" },
{
Protocol = DownloadProtocol.Usenet,
Id = 1,
Name = "Test"
},
DownloadId = "TestId", DownloadId = "TestId",
OutputPath = new OsPath(_downloadItemPath) OutputPath = new OsPath(_downloadItemPath)
}; };
@ -94,6 +89,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Ensure.That(path, () => path).IsValidPath(); Ensure.That(path, () => path).IsValidPath();
return false; return false;
}); });
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
} }
private void GivenFolderExists(string folder) private void GivenFolderExists(string folder)
@ -178,30 +177,30 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_return_ok_on_track_imported_event() public void should_return_ok_on_book_imported_event()
{ {
GivenFolderExists(_downloadRootPath); GivenFolderExists(_downloadRootPath);
var importEvent = new TrackImportedEvent(new LocalBook(), new BookFile(), new List<BookFile>(), true, new DownloadClientItem { DownloadClientInfo = new DownloadClientItemClientInfo() }); var importEvent = new TrackImportedEvent(new LocalBook(), new BookFile(), new List<BookFile>(), true, _downloadItem);
Subject.Check(importEvent).ShouldBeOk(); Subject.Check(importEvent).ShouldBeOk();
} }
[Test] [Test]
public void should_return_permissions_error_on_track_import_failed_event_if_file_exists() public void should_return_permissions_error_on_book_import_failed_event_if_file_exists()
{ {
var localTrack = new LocalBook var localBook = new LocalBook
{ {
Path = Path.Combine(_downloadItemPath, "file.mp3") Path = Path.Combine(_downloadItemPath, "file.mp3")
}; };
GivenFileExists(localTrack.Path); GivenFileExists(localBook.Path);
var importEvent = new TrackImportFailedEvent(new Exception(), localTrack, true, new DownloadClientItem { DownloadClientInfo = new DownloadClientItemClientInfo() }); var importEvent = new TrackImportFailedEvent(new Exception(), localBook, true, _downloadItem);
Subject.Check(importEvent).ShouldBeError(wikiFragment: "permissions-error"); Subject.Check(importEvent).ShouldBeError(wikiFragment: "permissions-error");
} }
[Test] [Test]
public void should_return_permissions_error_on_track_import_failed_event_if_folder_exists() public void should_return_permissions_error_on_book_import_failed_event_if_folder_exists()
{ {
GivenFolderExists(_downloadItemPath); GivenFolderExists(_downloadItemPath);
@ -211,7 +210,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_return_permissions_error_on_track_import_failed_event_for_local_client_if_folder_does_not_exist() public void should_return_permissions_error_on_book_import_failed_event_for_local_client_if_folder_does_not_exist()
{ {
var importEvent = new TrackImportFailedEvent(null, null, true, _downloadItem); var importEvent = new TrackImportFailedEvent(null, null, true, _downloadItem);
@ -219,7 +218,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_return_mapping_error_on_track_import_failed_event_for_remote_client_if_folder_does_not_exist() public void should_return_mapping_error_on_book_import_failed_event_for_remote_client_if_folder_does_not_exist()
{ {
_clientStatus.IsLocalhost = false; _clientStatus.IsLocalhost = false;
var importEvent = new TrackImportFailedEvent(null, null, true, _downloadItem); var importEvent = new TrackImportFailedEvent(null, null, true, _downloadItem);
@ -228,7 +227,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_return_mapping_error_on_track_import_failed_event_for_remote_client_if_path_invalid() public void should_return_mapping_error_on_book_import_failed_event_for_remote_client_if_path_invalid()
{ {
_clientStatus.IsLocalhost = false; _clientStatus.IsLocalhost = false;
_downloadItem.OutputPath = new OsPath("an invalid path"); _downloadItem.OutputPath = new OsPath("an invalid path");
@ -238,7 +237,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_return_download_client_error_on_track_import_failed_event_for_remote_client_if_path_invalid() public void should_return_download_client_error_on_book_import_failed_event_for_remote_client_if_path_invalid()
{ {
_clientStatus.IsLocalhost = true; _clientStatus.IsLocalhost = true;
_downloadItem.OutputPath = new OsPath("an invalid path"); _downloadItem.OutputPath = new OsPath("an invalid path");
@ -248,7 +247,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_return_docker_mapping_error_on_track_import_failed_event_inside_docker_if_folder_does_not_exist() public void should_return_docker_mapping_error_on_book_import_failed_event_inside_docker_if_folder_does_not_exist()
{ {
GivenDocker(); GivenDocker();

@ -7,6 +7,7 @@ using NzbDrone.Common.Disk;
using NzbDrone.Core.Books; using NzbDrone.Core.Books;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.ImportLists; using NzbDrone.Core.ImportLists;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks namespace NzbDrone.Core.Test.HealthCheck.Checks
@ -14,6 +15,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class RootFolderCheckFixture : CoreTest<RootFolderCheck> public class RootFolderCheckFixture : CoreTest<RootFolderCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
private void GivenMissingRootFolder() private void GivenMissingRootFolder()
{ {
var author = Builder<Author>.CreateListOfSize(1) var author = Builder<Author>.CreateListOfSize(1)
@ -34,7 +43,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetParentFolder(author.First().Path)) .Setup(s => s.GetParentFolder(author.First().Path))
.Returns(@"C:\Music"); .Returns(@"C:\Books");
Mocker.GetMock<IDiskProvider>() Mocker.GetMock<IDiskProvider>()
.Setup(s => s.FolderExists(It.IsAny<string>())) .Setup(s => s.FolderExists(It.IsAny<string>()))
@ -42,7 +51,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_not_return_error_when_no_author() public void should_not_return_error_when_no_book()
{ {
Mocker.GetMock<IAuthorService>() Mocker.GetMock<IAuthorService>()
.Setup(s => s.AllAuthorPaths()) .Setup(s => s.AllAuthorPaths())
@ -56,7 +65,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
} }
[Test] [Test]
public void should_return_error_if_author_parent_is_missing() public void should_return_error_if_book_parent_is_missing()
{ {
GivenMissingRootFolder(); GivenMissingRootFolder();

@ -6,6 +6,7 @@ using NzbDrone.Common.Cloud;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer; using NzbDrone.Common.Serializer;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
@ -24,6 +25,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
{ {
var json = new ServiceTimeResponse { DateTimeUtc = dateTime }.ToJson(); var json = new ServiceTimeResponse { DateTimeUtc = dateTime }.ToJson();
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("System time is off by more than 1 day. Scheduled tasks may not run correctly until the time is corrected");
Mocker.GetMock<IHttpClient>() Mocker.GetMock<IHttpClient>()
.Setup(s => s.Execute(It.IsAny<HttpRequest>())) .Setup(s => s.Execute(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Encoding.ASCII.GetBytes(json))); .Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), Encoding.ASCII.GetBytes(json)));

@ -1,9 +1,10 @@
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.HealthCheck.Checks; using NzbDrone.Core.HealthCheck.Checks;
using NzbDrone.Core.Localization;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Update; using NzbDrone.Core.Update;
@ -12,6 +13,14 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[TestFixture] [TestFixture]
public class UpdateCheckFixture : CoreTest<UpdateCheck> public class UpdateCheckFixture : CoreTest<UpdateCheck>
{ {
[SetUp]
public void Setup()
{
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("Some Warning Message");
}
[Test] [Test]
public void should_return_error_when_app_folder_is_write_protected() public void should_return_error_when_app_folder_is_write_protected()
{ {

@ -19,7 +19,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) || if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) ||
_appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder)) _appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder))
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Updating will not be possible to prevent deleting AppData on Update"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("AppDataLocationHealthCheckMessage"), "#updating-will-not-be-possible-to-prevent-deleting-appdata-on-update");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

@ -16,7 +16,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
private readonly IProvideDownloadClient _downloadClientProvider; private readonly IProvideDownloadClient _downloadClientProvider;
private readonly Logger _logger; private readonly Logger _logger;
public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, Logger logger, ILocalizationService localizationService) public DownloadClientCheck(IProvideDownloadClient downloadClientProvider, ILocalizationService localizationService, Logger logger)
: base(localizationService) : base(localizationService)
{ {
_downloadClientProvider = downloadClientProvider; _downloadClientProvider = downloadClientProvider;
@ -29,7 +29,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (!downloadClients.Any()) if (!downloadClients.Any())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No download client is available"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("DownloadClientCheckNoneAvailableMessage"), "#no-download-client-is-available");
} }
foreach (var downloadClient in downloadClients) foreach (var downloadClient in downloadClients)
@ -42,7 +42,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
_logger.Debug(ex, "Unable to communicate with {0}", downloadClient.Definition.Name); _logger.Debug(ex, "Unable to communicate with {0}", downloadClient.Definition.Name);
var message = $"Unable to communicate with {downloadClient.Definition.Name}."; var message = string.Format(_localizationService.GetLocalizedString("DownloadClientCheckUnableToCommunicateMessage"), downloadClient.Definition.Name);
return new HealthCheck(GetType(), HealthCheckResult.Error, $"{message} {ex.Message}", "#unable-to-communicate-with-download-client"); return new HealthCheck(GetType(), HealthCheckResult.Error, $"{message} {ex.Message}", "#unable-to-communicate-with-download-client");
} }
} }

@ -37,10 +37,10 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (backOffProviders.Count == enabledProviders.Count) if (backOffProviders.Count == enabledProviders.Count)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "All download clients are unavailable due to failures", "#download-clients-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("DownloadClientStatusCheckAllClientMessage"), "#download-clients-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Download clients unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("DownloadClientStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#download-clients-are-unavailable-due-to-failures");
} }
} }
} }

@ -37,10 +37,10 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (backOffProviders.Count == enabledProviders.Count) if (backOffProviders.Count == enabledProviders.Count)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "All import lists are unavailable due to failures", "#import-lists-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("ImportListStatusCheckAllClientMessage"), "#import-lists-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Import lists unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.ImportList.Definition.Name))), "#import-lists-are-unavailable-due-to-failures"); return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format(_localizationService.GetLocalizedString("ImportListStatusCheckSingleClientMessage"), string.Join(", ", backOffProviders.Select(v => v.ImportList.Definition.Name))), "#import-lists-are-unavailable-due-to-failures");
} }
} }
} }

@ -23,7 +23,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
if (!_configService.EnableCompletedDownloadHandling) if (!_configService.EnableCompletedDownloadHandling)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("ImportMechanismHealthCheckMessage"), "#completed-download-handling-is-disabled");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

@ -15,7 +15,9 @@ namespace NzbDrone.Core.HealthCheck.Checks
private readonly IIndexerFactory _providerFactory; private readonly IIndexerFactory _providerFactory;
private readonly IIndexerStatusService _providerStatusService; private readonly IIndexerStatusService _providerStatusService;
public IndexerLongTermStatusCheck(IIndexerFactory providerFactory, IIndexerStatusService providerStatusService, ILocalizationService localizationService) public IndexerLongTermStatusCheck(IIndexerFactory providerFactory,
IIndexerStatusService providerStatusService,
ILocalizationService localizationService)
: base(localizationService) : base(localizationService)
{ {
_providerFactory = providerFactory; _providerFactory = providerFactory;
@ -43,13 +45,13 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
"All indexers are unavailable due to failures for more than 6 hours", _localizationService.GetLocalizedString("IndexerLongTermStatusCheckAllClientMessage"),
"#indexers-are-unavailable-due-to-failures"); "#indexers-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Warning, HealthCheckResult.Warning,
string.Format("Indexers unavailable due to failures for more than 6 hours: {0}", string.Format(_localizationService.GetLocalizedString("IndexerLongTermStatusCheckSingleClientMessage"),
string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))),
"#indexers-are-unavailable-due-to-failures"); "#indexers-are-unavailable-due-to-failures");
} }

@ -25,14 +25,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (enabled.Empty()) if (enabled.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "No indexers available with RSS sync enabled, Readarr will not grab new releases automatically"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoIndexers"), "#no-indexers-available-with-rss-sync-enabled-readarr-will-not-grab-new-releases-automatically");
} }
var active = _indexerFactory.RssEnabled(true); var active = _indexerFactory.RssEnabled(true);
if (active.Empty()) if (active.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "All rss-capable indexers are temporarily unavailable due to recent indexer errors"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoAvailableIndexers"), "#indexers-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

@ -25,21 +25,21 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (automaticSearchEnabled.Empty()) if (automaticSearchEnabled.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Readarr will not provide any automatic search results"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAutomaticMessage"), "#no-indexers-available-with-automatic-search-enabled-readarr-will-not-provide-any-automatic-search-results");
} }
var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false);
if (interactiveSearchEnabled.Empty()) if (interactiveSearchEnabled.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Readarr will not provide any interactive search results"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoInteractiveMessage"), "#no-indexers-available-with-interactive-search-enabled");
} }
var active = _indexerFactory.AutomaticSearchEnabled(true); var active = _indexerFactory.AutomaticSearchEnabled(true);
if (active.Empty()) if (active.Empty())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Warning, "All search-capable indexers are temporarily unavailable due to recent indexer errors"); return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAvailableIndexersMessage"), "#indexers-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

@ -41,10 +41,17 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (backOffProviders.Count == enabledProviders.Count) if (backOffProviders.Count == enabledProviders.Count)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "All indexers are unavailable due to failures", "#indexers-are-unavailable-due-to-failures"); return new HealthCheck(GetType(),
HealthCheckResult.Error,
_localizationService.GetLocalizedString("IndexerStatusCheckAllClientMessage"),
"#indexers-are-unavailable-due-to-failures");
} }
return new HealthCheck(GetType(), HealthCheckResult.Warning, string.Format("Indexers unavailable due to failures: {0}", string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))), "#indexers-are-unavailable-due-to-failures"); return new HealthCheck(GetType(),
HealthCheckResult.Warning,
string.Format(_localizationService.GetLocalizedString("IndexerStatusCheckSingleClientMessage"),
string.Join(", ", backOffProviders.Select(v => v.Provider.Definition.Name))),
"#indexers-are-unavailable-due-to-failures");
} }
} }
} }

@ -1,6 +1,5 @@
using System.Linq; using System.Linq;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Books; using NzbDrone.Core.Books;
using NzbDrone.Core.Localization; using NzbDrone.Core.Localization;
@ -22,14 +21,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
// Not best for optimization but due to possible symlinks and junctions, we get mounts based on series path so internals can handle mount resolution. // Not best for optimization but due to possible symlinks and junctions, we get mounts based on series path so internals can handle mount resolution.
var mounts = _authorService.AllAuthorPaths() var mounts = _authorService.AllAuthorPaths()
.Select(path => _diskProvider.GetMount(path.Value)) .Select(p => _diskProvider.GetMount(p.Value))
.Where(m => m != null && m.MountOptions != null && m.MountOptions.IsReadOnly) .Where(m => m != null && m.MountOptions != null && m.MountOptions.IsReadOnly)
.DistinctBy(m => m.RootDirectory) .DistinctBy(m => m.RootDirectory)
.ToList(); .ToList();
if (mounts.Any()) if (mounts.Any())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "Mount containing a author path is mounted read-only: " + string.Join(",", mounts.Select(m => m.Name)), "#author-mount-ro"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("MountCheckMessage") + string.Join(", ", mounts.Select(m => m.Name)), "#author-mount-ro");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

@ -22,7 +22,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
} }
var message = _deploymentInfoProvider.PackageGlobalMessage; var message = _deploymentInfoProvider.PackageGlobalMessage;
HealthCheckResult result = HealthCheckResult.Notice; var result = HealthCheckResult.Notice;
if (message.StartsWith("Error:")) if (message.StartsWith("Error:"))
{ {

@ -19,7 +19,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
private readonly IHttpRequestBuilderFactory _cloudRequestBuilder; private readonly IHttpRequestBuilderFactory _cloudRequestBuilder;
public ProxyCheck(IReadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, Logger logger, ILocalizationService localizationService) public ProxyCheck(IReadarrCloudRequestBuilder cloudRequestBuilder, IConfigService configService, IHttpClient client, ILocalizationService localizationService, Logger logger)
: base(localizationService) : base(localizationService)
{ {
_configService = configService; _configService = configService;
@ -36,7 +36,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
var addresses = Dns.GetHostAddresses(_configService.ProxyHostname); var addresses = Dns.GetHostAddresses(_configService.ProxyHostname);
if (!addresses.Any()) if (!addresses.Any())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format("Failed to resolve the IP Address for the Configured Proxy Host {0}", _configService.ProxyHostname)); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckResolveIpMessage"), _configService.ProxyHostname), "#proxy-failed-resolve-ip");
} }
var request = _cloudRequestBuilder.Create() var request = _cloudRequestBuilder.Create()
@ -51,13 +51,13 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (response.StatusCode == HttpStatusCode.BadRequest) if (response.StatusCode == HttpStatusCode.BadRequest)
{ {
_logger.Error("Proxy Health Check failed: {0}", response.StatusCode); _logger.Error("Proxy Health Check failed: {0}", response.StatusCode);
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy. StatusCode: {response.StatusCode}"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckBadRequestMessage"), response.StatusCode), "#proxy-failed-test");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Error(ex, "Proxy Health Check failed"); _logger.Error(ex, "Proxy Health Check failed");
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Failed to test proxy: {request.Url}"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("ProxyCheckFailedToTestMessage"), request.Url), "#proxy-failed-test");
} }
} }

@ -22,7 +22,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
[CheckOn(typeof(ModelEvent<RemotePathMapping>))] [CheckOn(typeof(ModelEvent<RemotePathMapping>))]
[CheckOn(typeof(TrackImportedEvent), CheckOnCondition.FailedOnly)] [CheckOn(typeof(TrackImportedEvent), CheckOnCondition.FailedOnly)]
[CheckOn(typeof(TrackImportFailedEvent), CheckOnCondition.SuccessfulOnly)] [CheckOn(typeof(TrackImportFailedEvent), CheckOnCondition.SuccessfulOnly)]
public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheckWithMessage public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheck
{ {
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly IProvideDownloadClient _downloadClientProvider; private readonly IProvideDownloadClient _downloadClientProvider;
@ -67,15 +67,15 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
if (!status.IsLocalhost) if (!status.IsLocalhost)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#bad-remote-path-mapping"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckWrongOSPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#bad-remote-path-mapping");
} }
else if (_osInfo.IsDocker) else if (_osInfo.IsDocker)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#docker-bad-remote-path-mapping"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckBadDockerPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#docker-bad-remote-path-mapping");
} }
else else
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Local download client {client.Definition.Name} places downloads in {folder.FullPath} but this is not a valid {_osInfo.Name} path. Review your download client settings.", "#bad-download-client-settings"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckLocalWrongOSPath"), client.Definition.Name, folder.FullPath, _osInfo.Name), "#bad-download-client-settings");
} }
} }
@ -83,15 +83,15 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
if (_osInfo.IsDocker) if (_osInfo.IsDocker)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} places downloads in {folder.FullPath} but this directory does not appear to exist inside the container. Review your remote path mappings and container volume settings.", "#docker-bad-remote-path-mapping"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckDockerFolderMissing"), client.Definition.Name, folder.FullPath), "#docker-bad-remote-path-mapping");
} }
else if (!status.IsLocalhost) else if (!status.IsLocalhost)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} places downloads in {folder.FullPath} but this directory does not appear to exist. Likely missing or incorrect remote path mapping.", "#bad-remote-path-mapping"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckLocalFolderMissing"), client.Definition.Name, folder.FullPath), "#bad-remote-path-mapping");
} }
else else
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Download client {client.Definition.Name} places downloads in {folder.FullPath} but Readarr cannot see this directory. You may need to adjust the folder's permissions.", "#permissions-error"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckGenericPermissions"), client.Definition.Name, folder.FullPath), "#permissions-error");
} }
} }
} }
@ -127,13 +127,13 @@ namespace NzbDrone.Core.HealthCheck.Checks
var trackPath = failureMessage.BookInfo.Path; var trackPath = failureMessage.BookInfo.Path;
if (_diskProvider.FileExists(trackPath)) if (_diskProvider.FileExists(trackPath))
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Readarr can see but not access downloaded track {trackPath}. Likely permissions error.", "#permissions-error"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckDownloadPermissions"), trackPath), "#permissions-error");
} }
else else
{ {
// If the file doesn't exist but TrackInfo is not null then the message is coming from // If the file doesn't exist but TrackInfo is not null then the message is coming from
// ImportApprovedTracks and the file must have been removed part way through processing // ImportApprovedTracks and the file must have been removed part way through processing
return new HealthCheck(GetType(), HealthCheckResult.Error, $"File {trackPath} was removed part way though procesing."); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFileRemoved"), trackPath), "#remote-path-file-removed");
} }
} }
@ -149,43 +149,43 @@ namespace NzbDrone.Core.HealthCheck.Checks
// that the user realises something is wrong. // that the user realises something is wrong.
if (dlpath.IsNullOrWhiteSpace()) if (dlpath.IsNullOrWhiteSpace())
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Readarr failed to import a track. Check your logs for details."); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("RemotePathMappingCheckImportFailed"), "#remote-path-import-failed");
} }
if (!dlpath.IsPathValid()) if (!dlpath.IsPathValid())
{ {
if (!status.IsLocalhost) if (!status.IsLocalhost)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#bad-remote-path-mapping"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesWrongOSPath"), client.Definition.Name, dlpath, _osInfo.Name), "#bad-remote-path-mapping");
} }
else if (_osInfo.IsDocker) else if (_osInfo.IsDocker)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your remote path mappings and download client settings.", "#docker-bad-remote-path-mapping"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesBadDockerPath"), client.Definition.Name, dlpath, _osInfo.Name), "#docker-bad-remote-path-mapping");
} }
else else
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Local download client {client.Definition.Name} reported files in {dlpath} but this is not a valid {_osInfo.Name} path. Review your download client settings.", "#bad-download-client-settings"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesLocalWrongOSPath"), client.Definition.Name, dlpath, _osInfo.Name), "#bad-download-client-settings");
} }
} }
if (_diskProvider.FolderExists(dlpath)) if (_diskProvider.FolderExists(dlpath))
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Readarr can see but not access download directory {dlpath}. Likely permissions error.", "#permissions-error"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFolderPermissions"), dlpath), "#permissions-error");
} }
// if it's a remote client/docker, likely missing path mappings // if it's a remote client/docker, likely missing path mappings
if (_osInfo.IsDocker) if (_osInfo.IsDocker)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"You are using docker; download client {client.Definition.Name} reported files in {dlpath} but this directory does not appear to exist inside the container. Review your remote path mappings and container volume settings.", "#docker-bad-remote-path-mapping"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFolderPermissions"), client.Definition.Name, dlpath), "#docker-bad-remote-path-mapping");
} }
else if (!status.IsLocalhost) else if (!status.IsLocalhost)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Remote download client {client.Definition.Name} reported files in {dlpath} but this directory does not appear to exist. Likely missing remote path mapping.", "#bad-remote-path-mapping"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckRemoteDownloadClient"), client.Definition.Name, dlpath), "#bad-remote-path-mapping");
} }
else else
{ {
// path mappings shouldn't be needed locally so probably a permissions issue // path mappings shouldn't be needed locally so probably a permissions issue
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Download client {client.Definition.Name} reported files in {dlpath} but Readarr cannot see this directory. You may need to adjust the folder's permissions.", "#permissions-error"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RemotePathMappingCheckFilesGenericPermissions"), client.Definition.Name, dlpath), "#permissions-error");
} }
} }
catch (DownloadClientException ex) catch (DownloadClientException ex)

@ -50,10 +50,10 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
if (missingRootFolders.Count == 1) if (missingRootFolders.Count == 1)
{ {
return new HealthCheck(GetType(), HealthCheckResult.Error, "Missing root folder: " + missingRootFolders.First(), "#missing-root-folder"); return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("RootFolderCheckSingleMessage"), missingRootFolders.First()), "#missing-root-folder");
} }
var message = string.Format("Multiple root folders are missing: {0}", string.Join(" | ", missingRootFolders)); var message = string.Format(_localizationService.GetLocalizedString("RootFolderCheckMultipleMessage"), string.Join(" | ", missingRootFolders));
return new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder"); return new HealthCheck(GetType(), HealthCheckResult.Error, message, "#missing-root-folder");
} }

@ -13,7 +13,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
private readonly IHttpRequestBuilderFactory _cloudRequestBuilder; private readonly IHttpRequestBuilderFactory _cloudRequestBuilder;
private readonly Logger _logger; private readonly Logger _logger;
public SystemTimeCheck(IHttpClient client, IReadarrCloudRequestBuilder cloudRequestBuilder, Logger logger, ILocalizationService localizationService) public SystemTimeCheck(IHttpClient client, IReadarrCloudRequestBuilder cloudRequestBuilder, ILocalizationService localizationService, Logger logger)
: base(localizationService) : base(localizationService)
{ {
_client = client; _client = client;
@ -35,7 +35,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (Math.Abs(result.DateTimeUtc.Subtract(systemTime).TotalDays) >= 1) if (Math.Abs(result.DateTimeUtc.Subtract(systemTime).TotalDays) >= 1)
{ {
_logger.Error("System time mismatch. SystemTime: {0} Expected Time: {1}. Update system time", systemTime, result.DateTimeUtc); _logger.Error("System time mismatch. SystemTime: {0} Expected Time: {1}. Update system time", systemTime, result.DateTimeUtc);
return new HealthCheck(GetType(), HealthCheckResult.Error, $"System time is off by more than 1 day. Scheduled tasks may not run correctly until the time is corrected"); return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("SystemTimeCheckMessage"), "#system-time-off");
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

@ -47,33 +47,30 @@ namespace NzbDrone.Core.HealthCheck.Checks
{ {
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
string.Format("Cannot install update because startup folder '{0}' is in an App Translocation folder.", startupFolder), string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupTranslocationMessage"), startupFolder),
"Cannot install update because startup folder is in an App Translocation folder."); "#cannot-install-update-because-startup-folder-is-in-an-app-translocation-folder.");
} }
if (!_diskProvider.FolderWritable(startupFolder)) if (!_diskProvider.FolderWritable(startupFolder))
{ {
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
string.Format("Cannot install update because startup folder '{0}' is not writable by the user '{1}'.", startupFolder, Environment.UserName), string.Format(_localizationService.GetLocalizedString("UpdateCheckStartupNotWritableMessage"), startupFolder, Environment.UserName),
"Cannot install update because startup folder is not writable by the user"); "#cannot-install-update-because-startup-folder-is-not-writable-by-the-user");
} }
if (!_diskProvider.FolderWritable(uiFolder)) if (!_diskProvider.FolderWritable(uiFolder))
{ {
return new HealthCheck(GetType(), return new HealthCheck(GetType(),
HealthCheckResult.Error, HealthCheckResult.Error,
string.Format("Cannot install update because UI folder '{0}' is not writable by the user '{1}'.", uiFolder, Environment.UserName), string.Format(_localizationService.GetLocalizedString("UpdateCheckUINotWritableMessage"), uiFolder, Environment.UserName),
"Cannot install update because UI folder is not writable by the user"); "#cannot-install-update-because-ui-folder-is-not-writable-by-the-user");
} }
} }
if (BuildInfo.BuildDateTime < DateTime.UtcNow.AddDays(-14)) if (BuildInfo.BuildDateTime < DateTime.UtcNow.AddDays(-14) && _checkUpdateService.AvailableUpdate() != null)
{ {
if (_checkUpdateService.AvailableUpdate() != null) return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("UpdateAvailable"), "#new-update-is-available");
{
return new HealthCheck(GetType(), HealthCheckResult.Warning, "New update is available");
}
} }
return new HealthCheck(GetType()); return new HealthCheck(GetType());

@ -1,4 +1,3 @@
using System;
using NzbDrone.Common.Messaging; using NzbDrone.Common.Messaging;
namespace NzbDrone.Core.HealthCheck namespace NzbDrone.Core.HealthCheck

@ -32,6 +32,7 @@
"APIKey": "API Key", "APIKey": "API Key",
"ApiKeyHelpTextWarning": "Requires restart to take effect", "ApiKeyHelpTextWarning": "Requires restart to take effect",
"AppDataDirectory": "AppData directory", "AppDataDirectory": "AppData directory",
"AppDataLocationHealthCheckMessage": "Updating will not be possible to prevent deleting AppData on Update",
"ApplyTags": "Apply Tags", "ApplyTags": "Apply Tags",
"ApplyTagsHelpTexts1": "How to apply tags to the selected author", "ApplyTagsHelpTexts1": "How to apply tags to the selected author",
"ApplyTagsHelpTexts2": "Add: Add the tags the existing list of tags", "ApplyTagsHelpTexts2": "Add: Add the tags the existing list of tags",
@ -190,8 +191,10 @@
"Docker": "Docker", "Docker": "Docker",
"DownloadClient": "Download Client", "DownloadClient": "Download Client",
"DownloadClientCheckDownloadingToRoot": "Download client {0} places downloads in the root folder {1}. You should not download to a root folder.", "DownloadClientCheckDownloadingToRoot": "Download client {0} places downloads in the root folder {1}. You should not download to a root folder.",
"DownloadClientCheckNoneAvailableMessage": "No download client is available",
"DownloadClients": "Download Clients", "DownloadClients": "Download Clients",
"DownloadClientSettings": "Download Client Settings", "DownloadClientSettings": "Download Client Settings",
"DownloadClientStatusCheckAllClientMessage": "All download clients are unavailable due to failures",
"DownloadFailedCheckDownloadClientForMoreDetails": "Download failed: check download client for more details", "DownloadFailedCheckDownloadClientForMoreDetails": "Download failed: check download client for more details",
"DownloadFailedInterp": "Download failed: {0}", "DownloadFailedInterp": "Download failed: {0}",
"DownloadPropersAndRepacksHelpTexts1": "Whether or not to automatically upgrade to Propers/Repacks", "DownloadPropersAndRepacksHelpTexts1": "Whether or not to automatically upgrade to Propers/Repacks",
@ -297,6 +300,8 @@
"ImportLists": "Import Lists", "ImportLists": "Import Lists",
"ImportListSettings": "General Import List Settings", "ImportListSettings": "General Import List Settings",
"ImportListSpecificSettings": "Import List Specific Settings", "ImportListSpecificSettings": "Import List Specific Settings",
"ImportListStatusCheckAllClientMessage": "All lists are unavailable due to failures",
"ImportMechanismHealthCheckMessage": "Enable Completed Download Handling",
"IncludeHealthWarningsHelpText": "Include Health Warnings", "IncludeHealthWarningsHelpText": "Include Health Warnings",
"IncludePreferredWhenRenaming": "Include Preferred when Renaming", "IncludePreferredWhenRenaming": "Include Preferred when Renaming",
"IncludeUnknownAuthorItemsHelpText": "Show items without a author in the queue, this could include removed authors, movies or anything else in Readarr's category", "IncludeUnknownAuthorItemsHelpText": "Show items without a author in the queue, this could include removed authors, movies or anything else in Readarr's category",
@ -306,10 +311,14 @@
"IndexerIdHelpTextWarning": "Using a specific indexer with preferred words can lead to duplicate releases being grabbed", "IndexerIdHelpTextWarning": "Using a specific indexer with preferred words can lead to duplicate releases being grabbed",
"IndexerIdvalue0IncludeInPreferredWordsRenamingFormat": "Include in {Preferred Words} renaming format", "IndexerIdvalue0IncludeInPreferredWordsRenamingFormat": "Include in {Preferred Words} renaming format",
"IndexerIdvalue0OnlySupportedWhenIndexerIsSetToAll": "Only supported when Indexer is set to (All)", "IndexerIdvalue0OnlySupportedWhenIndexerIsSetToAll": "Only supported when Indexer is set to (All)",
"IndexerLongTermStatusCheckAllClientMessage": "All indexers are unavailable due to failures for more than 6 hours",
"IndexerPriority": "Indexer Priority", "IndexerPriority": "Indexer Priority",
"IndexerRssHealthCheckNoIndexers": "No indexers available with RSS sync enabled, Readarr will not grab new releases automatically",
"Indexers": "Indexers", "Indexers": "Indexers",
"IndexerSearchCheckNoAutomaticMessage": "No indexers available with Automatic Search enabled, Readarr will not provide any automatic search results",
"IndexerSettings": "Indexer Settings", "IndexerSettings": "Indexer Settings",
"IndexersSettingsSummary": "Download clients, download handling and remote path mappings", "IndexersSettingsSummary": "Download clients, download handling and remote path mappings",
"IndexerStatusCheckAllClientMessage": "All indexers are unavailable due to failures",
"Interval": "Interval", "Interval": "Interval",
"ISBN": "ISBN", "ISBN": "ISBN",
"IsCalibreLibraryHelpText": "Use Calibre Content Server to manipulate library", "IsCalibreLibraryHelpText": "Use Calibre Content Server to manipulate library",
@ -402,6 +411,7 @@
"MonitorNewItemsHelpText": "Which new books should be monitored", "MonitorNewItemsHelpText": "Which new books should be monitored",
"MonoVersion": "Mono Version", "MonoVersion": "Mono Version",
"MoreInfo": "More Info", "MoreInfo": "More Info",
"MountCheckMessage": "Mount containing an author path is mounted read-only: ",
"MusicBrainzAuthorID": "MusicBrainz Author ID", "MusicBrainzAuthorID": "MusicBrainz Author ID",
"MusicBrainzBookID": "MusicBrainz Book ID", "MusicBrainzBookID": "MusicBrainz Book ID",
"MusicbrainzId": "Musicbrainz Id", "MusicbrainzId": "Musicbrainz Id",
@ -495,6 +505,7 @@
"ProtocolHelpText": "Choose which protocol(s) to use and which one is preferred when choosing between otherwise equal releases", "ProtocolHelpText": "Choose which protocol(s) to use and which one is preferred when choosing between otherwise equal releases",
"Proxy": "Proxy", "Proxy": "Proxy",
"ProxyBypassFilterHelpText": "Use ',' as a separator, and '*.' as a wildcard for subdomains", "ProxyBypassFilterHelpText": "Use ',' as a separator, and '*.' as a wildcard for subdomains",
"ProxyCheckResolveIpMessage": "Failed to resolve the IP Address for the Configured Proxy Host {0}",
"ProxyPasswordHelpText": "You only need to enter a username and password if one is required. Leave them blank otherwise.", "ProxyPasswordHelpText": "You only need to enter a username and password if one is required. Leave them blank otherwise.",
"ProxyType": "Proxy Type", "ProxyType": "Proxy Type",
"ProxyUsernameHelpText": "You only need to enter a username and password if one is required. Leave them blank otherwise.", "ProxyUsernameHelpText": "You only need to enter a username and password if one is required. Leave them blank otherwise.",
@ -538,6 +549,7 @@
"Reload": "Reload", "Reload": "Reload",
"RemotePath": "Remote Path", "RemotePath": "Remote Path",
"RemotePathHelpText": "Root path to the directory that the Download Client accesses", "RemotePathHelpText": "Root path to the directory that the Download Client accesses",
"RemotePathMappingCheckWrongOSPath": "Remote download client {0} places downloads in {1} but this is not a valid {2} path. Review your remote path mappings and download client settings.",
"RemotePathMappings": "Remote Path Mappings", "RemotePathMappings": "Remote Path Mappings",
"Remove": "Remove", "Remove": "Remove",
"RemoveCompletedDownloadsHelpText": "Remove imported downloads from download client history", "RemoveCompletedDownloadsHelpText": "Remove imported downloads from download client history",
@ -575,6 +587,7 @@
"RetentionHelpText": "Usenet only: Set to zero to set for unlimited retention", "RetentionHelpText": "Usenet only: Set to zero to set for unlimited retention",
"RetryingDownloadInterp": "Retrying download {0} at {1}", "RetryingDownloadInterp": "Retrying download {0} at {1}",
"RootFolder": "Root Folder", "RootFolder": "Root Folder",
"RootFolderCheckSingleMessage": "Missing root folder: {0}",
"RootFolderPathHelpText": "Root Folder list items will be added to", "RootFolderPathHelpText": "Root Folder list items will be added to",
"RootFolders": "Root Folders", "RootFolders": "Root Folders",
"RSSSync": "RSS Sync", "RSSSync": "RSS Sync",
@ -672,6 +685,7 @@
"SupportsSearchvalueSearchIsNotSupportedWithThisIndexer": "Search is not supported with this indexer", "SupportsSearchvalueSearchIsNotSupportedWithThisIndexer": "Search is not supported with this indexer",
"SupportsSearchvalueWillBeUsedWhenAutomaticSearchesArePerformedViaTheUIOrByReadarr": "Will be used when automatic searches are performed via the UI or by Readarr", "SupportsSearchvalueWillBeUsedWhenAutomaticSearchesArePerformedViaTheUIOrByReadarr": "Will be used when automatic searches are performed via the UI or by Readarr",
"SupportsSearchvalueWillBeUsedWhenInteractiveSearchIsUsed": "Will be used when interactive search is used", "SupportsSearchvalueWillBeUsedWhenInteractiveSearchIsUsed": "Will be used when interactive search is used",
"SystemTimeCheckMessage": "System time is off by more than 1 day. Scheduled tasks may not run correctly until the time is corrected",
"TagIsNotUsedAndCanBeDeleted": "Tag is not used and can be deleted", "TagIsNotUsedAndCanBeDeleted": "Tag is not used and can be deleted",
"Tags": "Tags", "Tags": "Tags",
"TagsHelpText": "Applies to authors with at least one matching tag. Leave blank to apply to all authors", "TagsHelpText": "Applies to authors with at least one matching tag. Leave blank to apply to all authors",
@ -749,6 +763,7 @@
"UnselectAll": "Unselect All", "UnselectAll": "Unselect All",
"UpdateAll": "Update all", "UpdateAll": "Update all",
"UpdateAutomaticallyHelpText": "Automatically download and install updates. You will still be able to install from System: Updates", "UpdateAutomaticallyHelpText": "Automatically download and install updates. You will still be able to install from System: Updates",
"UpdateCheckStartupTranslocationMessage": "Cannot install update because startup folder '{0}' is in an App Translocation folder.",
"UpdateCovers": "Update Covers", "UpdateCovers": "Update Covers",
"UpdateCoversHelpText": "Set book covers in Calibre to match those in Readarr", "UpdateCoversHelpText": "Set book covers in Calibre to match those in Readarr",
"UpdateMechanismHelpText": "Use Readarr's built-in updater or a script", "UpdateMechanismHelpText": "Use Readarr's built-in updater or a script",

Loading…
Cancel
Save