mirror of https://github.com/Radarr/Radarr
Fixed: RemotePathMappingCheck Improvements
This commit is contained in:
parent
cae4faae61
commit
685a24e476
|
@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.Download
|
||||||
_downloadClients = new List<IDownloadClient>();
|
_downloadClients = new List<IDownloadClient>();
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(v => v.GetDownloadClients())
|
.Setup(v => v.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(_downloadClients);
|
.Returns(_downloadClients);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
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(It.IsAny<bool>()))
|
||||||
.Returns(Array.Empty<IDownloadClient>());
|
.Returns(Array.Empty<IDownloadClient>());
|
||||||
|
|
||||||
Subject.Check().ShouldBeWarning();
|
Subject.Check().ShouldBeWarning();
|
||||||
|
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Throws<Exception>();
|
.Throws<Exception>();
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { downloadClient.Object });
|
.Returns(new IDownloadClient[] { downloadClient.Object });
|
||||||
|
|
||||||
Subject.Check().ShouldBeError();
|
Subject.Check().ShouldBeError();
|
||||||
|
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(new List<DownloadClientItem>());
|
.Returns(new List<DownloadClientItem>());
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { downloadClient.Object });
|
.Returns(new IDownloadClient[] { downloadClient.Object });
|
||||||
|
|
||||||
Subject.Check().ShouldBeOk();
|
Subject.Check().ShouldBeOk();
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(_clientStatus);
|
.Returns(_clientStatus);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(_clientStatus);
|
.Returns(_clientStatus);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(_clientStatus);
|
.Returns(_clientStatus);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
||||||
|
|
||||||
Mocker.GetMock<IConfigService>()
|
Mocker.GetMock<IConfigService>()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
|
@ -53,7 +54,8 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
return new HealthCheck(GetType());
|
return new HealthCheck(GetType());
|
||||||
}
|
}
|
||||||
|
|
||||||
var clients = _downloadClientProvider.GetDownloadClients();
|
// Only check clients not in failure status, those get another message
|
||||||
|
var clients = _downloadClientProvider.GetDownloadClients(true);
|
||||||
|
|
||||||
foreach (var client in clients)
|
foreach (var client in clients)
|
||||||
{
|
{
|
||||||
|
@ -100,6 +102,10 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
{
|
{
|
||||||
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
||||||
}
|
}
|
||||||
|
catch (HttpRequestException ex)
|
||||||
|
{
|
||||||
|
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, "Unknown error occured in RemotePathMapping HealthCheck");
|
_logger.Error(ex, "Unknown error occured in RemotePathMapping HealthCheck");
|
||||||
|
@ -139,7 +145,14 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
|
|
||||||
// If the previous case did not match then the failure occured in DownloadedMovieImportService,
|
// If the previous case did not match then the failure occured in DownloadedMovieImportService,
|
||||||
// while trying to locate the files reported by the download client
|
// while trying to locate the files reported by the download client
|
||||||
var client = _downloadClientProvider.GetDownloadClients().FirstOrDefault(x => x.Definition.Name == failureMessage.DownloadClientInfo.Name);
|
// Only check clients not in failure status, those get another message
|
||||||
|
var client = _downloadClientProvider.GetDownloadClients(true).FirstOrDefault(x => x.Definition.Name == failureMessage.DownloadClientInfo.Name);
|
||||||
|
|
||||||
|
if (client == null)
|
||||||
|
{
|
||||||
|
return new HealthCheck(GetType());
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var status = client.GetStatus();
|
var status = client.GetStatus();
|
||||||
|
@ -192,6 +205,10 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
{
|
{
|
||||||
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
||||||
}
|
}
|
||||||
|
catch (HttpRequestException ex)
|
||||||
|
{
|
||||||
|
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, "Unknown error occured in RemotePathMapping HealthCheck");
|
_logger.Error(ex, "Unknown error occured in RemotePathMapping HealthCheck");
|
||||||
|
|
Loading…
Reference in New Issue