mirror of
https://github.com/Radarr/Radarr
synced 2025-02-23 14:51:17 +00:00
try to import file anyway if free space check fails.
This commit is contained in:
parent
c01194e345
commit
7ae605e474
2 changed files with 28 additions and 4 deletions
|
@ -51,7 +51,7 @@ private void GivenFileSize(long size)
|
||||||
_localEpisode.Size = size;
|
_localEpisode.Size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenFreeSpace(long size)
|
private void GivenFreeSpace(long? size)
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Setup(s => s.GetAvailableSpace(It.IsAny<String>()))
|
.Setup(s => s.GetAvailableSpace(It.IsAny<String>()))
|
||||||
|
@ -98,5 +98,30 @@ public void should_use_series_paths_parent_for_free_space_check()
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Verify(v => v.GetAvailableSpace(_rootFolder), Times.Once());
|
.Verify(v => v.GetAvailableSpace(_rootFolder), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_pass_if_free_space_is_null()
|
||||||
|
{
|
||||||
|
GivenFileSize(100.Megabytes());
|
||||||
|
GivenFreeSpace(null);
|
||||||
|
|
||||||
|
Subject.IsSatisfiedBy(_localEpisode).Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_pass_if_exception_is_thrown()
|
||||||
|
{
|
||||||
|
GivenFileSize(100.Megabytes());
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Setup(s => s.GetAvailableSpace(It.IsAny<String>()))
|
||||||
|
.Throws(new TestException());
|
||||||
|
|
||||||
|
Subject.IsSatisfiedBy(_localEpisode).Should().BeTrue();
|
||||||
|
ExceptionVerification.ExpectedWarns(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,13 @@ public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
||||||
_logger.Warn("Not enough free space to import: {0}", localEpisode);
|
_logger.Warn("Not enough free space to import: {0}", localEpisode);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException("Unable to check free disk space while importing: " + localEpisode.Path, ex);
|
_logger.ErrorException("Unable to check free disk space while importing: " + localEpisode.Path, ex);
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue