mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-08 05:51:47 -07:00
Fixed: RemotePathMappingCheck ignores all download client exceptions (#735)
This commit is contained in:
parent
11eaa58c1c
commit
b1aff8fe58
2 changed files with 19 additions and 9 deletions
|
@ -27,6 +27,12 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
private DownloadClientItem downloadItem;
|
private DownloadClientItem downloadItem;
|
||||||
private Mock<IDownloadClient> downloadClient;
|
private Mock<IDownloadClient> downloadClient;
|
||||||
|
|
||||||
|
static Exception[] DownloadClientExceptions = {
|
||||||
|
new DownloadClientUnavailableException("error"),
|
||||||
|
new DownloadClientAuthenticationException("error"),
|
||||||
|
new DownloadClientException("error")
|
||||||
|
};
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
|
@ -132,13 +138,15 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
Subject.Check().ShouldBeError(wikiFragment: "bad-remote-path-mapping");
|
Subject.Check().ShouldBeError(wikiFragment: "bad-remote-path-mapping");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test, TestCaseSource("DownloadClientExceptions")]
|
||||||
public void should_return_ok_if_client_unavailable()
|
public void should_return_ok_if_client_throws_downloadclientexception(Exception ex)
|
||||||
{
|
{
|
||||||
downloadClient.Setup(s => s.GetStatus())
|
downloadClient.Setup(s => s.GetStatus())
|
||||||
.Throws(new DownloadClientUnavailableException("error"));
|
.Throws(ex);
|
||||||
|
|
||||||
Subject.Check().ShouldBeOk();
|
Subject.Check().ShouldBeOk();
|
||||||
|
|
||||||
|
ExceptionVerification.ExpectedErrors(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -229,15 +237,17 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
Subject.Check(importEvent).ShouldBeError(wikiFragment: "docker-bad-remote-path-mapping");
|
Subject.Check(importEvent).ShouldBeError(wikiFragment: "docker-bad-remote-path-mapping");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test, TestCaseSource("DownloadClientExceptions")]
|
||||||
public void should_return_ok_on_import_failed_event_if_client_unavailable()
|
public void should_return_ok_on_import_failed_event_if_client_throws_downloadclientexception(Exception ex)
|
||||||
{
|
{
|
||||||
downloadClient.Setup(s => s.GetStatus())
|
downloadClient.Setup(s => s.GetStatus())
|
||||||
.Throws(new DownloadClientUnavailableException("error"));
|
.Throws(ex);
|
||||||
|
|
||||||
var importEvent = new TrackImportFailedEvent(null, null, true, downloadItem);
|
var importEvent = new TrackImportFailedEvent(null, null, true, downloadItem);
|
||||||
|
|
||||||
Subject.Check(importEvent).ShouldBeOk();
|
Subject.Check(importEvent).ShouldBeOk();
|
||||||
|
|
||||||
|
ExceptionVerification.ExpectedErrors(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (DownloadClientUnavailableException ex)
|
catch (DownloadClientException ex)
|
||||||
{
|
{
|
||||||
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Download client {client.Definition.Name} reported files in {dlpath} but Lidarr cannot see this directory. You may need to adjust the folder's permissions.", "#permissions-error");
|
return new HealthCheck(GetType(), HealthCheckResult.Error, $"Download client {client.Definition.Name} reported files in {dlpath} but Lidarr cannot see this directory. You may need to adjust the folder's permissions.", "#permissions-error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (DownloadClientUnavailableException ex)
|
catch (DownloadClientException ex)
|
||||||
{
|
{
|
||||||
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
_logger.Debug(ex, "Unable to communicate with {0}", client.Definition.Name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue