1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-17 15:02:34 +02:00

Fixed removing partials before trying to copy files.

This commit is contained in:
Taloth Saldono 2015-10-09 00:00:28 +02:00
parent a39b36d157
commit bb482047b1
2 changed files with 21 additions and 2 deletions

View File

@ -378,7 +378,7 @@ public void should_log_error_if_rollback_partialmove_fails()
}
[Test]
public void mode_transactional_should_delete_old_backup()
public void mode_transactional_should_delete_old_backup_on_move()
{
Subject.VerificationMode = DiskTransferVerificationMode.Transactional;
@ -393,7 +393,7 @@ public void mode_transactional_should_delete_old_backup()
}
[Test]
public void mode_transactional_should_delete_old_partial()
public void mode_transactional_should_delete_old_partial_on_move()
{
Subject.VerificationMode = DiskTransferVerificationMode.Transactional;
@ -407,6 +407,19 @@ public void mode_transactional_should_delete_old_partial()
.Verify(v => v.DeleteFile(_tempTargetPath), Times.Once());
}
[Test]
public void mode_transactional_should_delete_old_partial_on_copy()
{
Subject.VerificationMode = DiskTransferVerificationMode.Transactional;
WithExistingFile(_tempTargetPath);
Subject.TransferFile(_sourcePath, _targetPath, TransferMode.Copy);
Mocker.GetMock<IDiskProvider>()
.Verify(v => v.DeleteFile(_tempTargetPath), Times.Once());
}
[Test]
public void mode_transactional_should_hardlink_before_move()
{

View File

@ -316,6 +316,12 @@ private bool TryCopyFile(string sourcePath, string targetPath)
var tempTargetPath = targetPath + ".partial~";
if (_diskProvider.FileExists(tempTargetPath))
{
_logger.Trace("Removing old partial.");
_diskProvider.DeleteFile(tempTargetPath);
}
try
{
for (var i = 0; i <= RetryCount; i++)