Fixed: Detecting NzbGet free-space errors during unpack and move errors as warnings.

Fixed: NzbGet Script errors are again considered failures so that corruption-detection scripts trigger drone to grab another release.
This commit is contained in:
Taloth Saldono 2014-09-25 20:48:41 +02:00
parent efbce27a7c
commit d8d641b8df
2 changed files with 48 additions and 7 deletions

View File

@ -210,7 +210,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
}
[Test]
public void should_report_health_deletestatus_as_failed()
public void should_report_deletestatus_health_as_failed()
{
_completed.DeleteStatus = "HEALTH";
@ -223,9 +223,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
}
[Test]
public void should_report_script_error_as_warning()
public void should_report_unpackstatus_freespace_as_warning()
{
_completed.ScriptStatus = "FAILED";
_completed.UnpackStatus = "SPACE";
GivenQueue(null);
GivenHistory(_completed);
@ -235,6 +235,35 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
items.First().Status.Should().Be(DownloadItemStatus.Warning);
}
[Test]
public void should_report_movestatus_failure_as_warning()
{
_completed.MoveStatus = "FAILURE";
GivenQueue(null);
GivenHistory(_completed);
var items = Subject.GetItems();
items.First().Status.Should().Be(DownloadItemStatus.Warning);
}
[Test]
public void should_report_scriptstatus_failure_as_failed()
{
// TODO: We would love to have a way to distinguish between scripts reporting video corruption, or some internal script error.
// That way we could return Warning instead of Failed to notify the user to take action.
_completed.ScriptStatus = "FAILURE";
GivenQueue(null);
GivenHistory(_completed);
var items = Subject.GetItems();
items.First().Status.Should().Be(DownloadItemStatus.Failed);
}
[Test]
public void Download_should_return_unique_id()

View File

@ -158,17 +158,29 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
continue;
}
if (!successStatus.Contains(item.ParStatus) ||
!successStatus.Contains(item.UnpackStatus) ||
!successStatus.Contains(item.MoveStatus))
if (!successStatus.Contains(item.ParStatus))
{
historyItem.Status = DownloadItemStatus.Failed;
}
if (!successStatus.Contains(item.ScriptStatus))
if (item.UnpackStatus == "SPACE")
{
historyItem.Status = DownloadItemStatus.Warning;
}
else if (!successStatus.Contains(item.UnpackStatus))
{
historyItem.Status = DownloadItemStatus.Failed;
}
if (!successStatus.Contains(item.MoveStatus))
{
historyItem.Status = DownloadItemStatus.Warning;
}
if (!successStatus.Contains(item.ScriptStatus))
{
historyItem.Status = DownloadItemStatus.Failed;
}
if (!successStatus.Contains(item.DeleteStatus))
{