Added additional test to check retry interval.

pull/106/merge
Taloth Saldono 10 years ago
parent 1bca66a0c2
commit 7116167ea7

@ -93,9 +93,10 @@ namespace NzbDrone.Core.Test.Download
Mocker.GetMock<IConfigService>().SetupGet(s => s.BlacklistGracePeriod).Returns(hours);
}
private void GivenRetryLimit(int count)
private void GivenRetryLimit(int count, int interval = 5)
{
Mocker.GetMock<IConfigService>().SetupGet(s => s.BlacklistRetryLimit).Returns(count);
Mocker.GetMock<IConfigService>().SetupGet(s => s.BlacklistRetryInterval).Returns(interval);
}
private void VerifyNoFailedDownloads()
@ -375,6 +376,35 @@ namespace NzbDrone.Core.Test.Download
VerifyNoRetryDownload();
}
[Test]
public void should_retry_if_interval_expired()
{
GivenFailedDownloadClientHistory();
var historyGrabbed = Builder<History.History>.CreateListOfSize(1)
.Build()
.ToList();
historyGrabbed.First().Data.Add("downloadClient", "SabnzbdClient");
historyGrabbed.First().Data.Add("downloadClientId", _failed.First().DownloadClientId);
historyGrabbed.First().Data.Add("ageHours", "1");
GivenGrabbedHistory(historyGrabbed);
GivenNoFailedHistory();
GivenGracePeriod(6);
GivenRetryLimit(1);
Subject.Execute(new CheckForFinishedDownloadCommand());
Subject.GetTrackedDownloads().First().LastRetry -= TimeSpan.FromMinutes(10);
Subject.Execute(new CheckForFinishedDownloadCommand());
VerifyRetryDownload();
ExceptionVerification.IgnoreWarns();
}
[Test]
public void should_process_if_retry_count_is_greater_than_grace_period()
{
@ -419,7 +449,7 @@ namespace NzbDrone.Core.Test.Download
Subject.Execute(new CheckForFinishedDownloadCommand());
VerifyNoFailedDownloads();
VerifyRetryDownload();
VerifyNoRetryDownload();
ExceptionVerification.IgnoreWarns();
}

Loading…
Cancel
Save