mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
Disabled verified file transfer on windows.
This commit is contained in:
parent
5effca92b8
commit
546f4ab577
@ -47,10 +47,24 @@ public void should_throw_if_hardlink_only_failed()
|
|||||||
Assert.Throws<IOException>(() => Subject.TransferFile(_sourcePath, _targetPath, TransferMode.HardLink));
|
Assert.Throws<IOException>(() => Subject.TransferFile(_sourcePath, _targetPath, TransferMode.HardLink));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_not_use_verified_transfer_on_windows()
|
||||||
|
{
|
||||||
|
WindowsOnly();
|
||||||
|
|
||||||
|
var result = Subject.TransferFile(_sourcePath, _targetPath, TransferMode.Move);
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Verify(v => v.TryCreateHardLink(_sourcePath, _backupPath), Times.Never());
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Verify(v => v.MoveFile(_sourcePath, _targetPath, false), Times.Once());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_retry_if_partial_copy()
|
public void should_retry_if_partial_copy()
|
||||||
{
|
{
|
||||||
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
MonoOnly();
|
||||||
|
|
||||||
var retry = 0;
|
var retry = 0;
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
@ -69,6 +83,8 @@ public void should_retry_if_partial_copy()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_retry_twice_if_partial_copy()
|
public void should_retry_twice_if_partial_copy()
|
||||||
{
|
{
|
||||||
|
MonoOnly();
|
||||||
|
|
||||||
var retry = 0;
|
var retry = 0;
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Setup(v => v.CopyFile(_sourcePath, _tempTargetPath, false))
|
.Setup(v => v.CopyFile(_sourcePath, _tempTargetPath, false))
|
||||||
@ -87,6 +103,8 @@ public void should_retry_twice_if_partial_copy()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_hardlink_before_move()
|
public void should_hardlink_before_move()
|
||||||
{
|
{
|
||||||
|
MonoOnly();
|
||||||
|
|
||||||
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
||||||
|
|
||||||
var result = Subject.TransferFile(_sourcePath, _targetPath, TransferMode.Move);
|
var result = Subject.TransferFile(_sourcePath, _targetPath, TransferMode.Move);
|
||||||
@ -98,6 +116,8 @@ public void should_hardlink_before_move()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_remove_source_after_move()
|
public void should_remove_source_after_move()
|
||||||
{
|
{
|
||||||
|
MonoOnly();
|
||||||
|
|
||||||
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
@ -112,6 +132,8 @@ public void should_remove_source_after_move()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_remove_backup_if_move_throws()
|
public void should_remove_backup_if_move_throws()
|
||||||
{
|
{
|
||||||
|
MonoOnly();
|
||||||
|
|
||||||
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
@ -126,6 +148,8 @@ public void should_remove_backup_if_move_throws()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_remove_partial_if_move_fails()
|
public void should_remove_partial_if_move_fails()
|
||||||
{
|
{
|
||||||
|
MonoOnly();
|
||||||
|
|
||||||
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
WithSuccessfulHardlink(_sourcePath, _backupPath);
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
@ -144,6 +168,8 @@ public void should_remove_partial_if_move_fails()
|
|||||||
[Test]
|
[Test]
|
||||||
public void should_fallback_to_copy_if_hardlink_failed()
|
public void should_fallback_to_copy_if_hardlink_failed()
|
||||||
{
|
{
|
||||||
|
MonoOnly();
|
||||||
|
|
||||||
WithFailedHardlink();
|
WithFailedHardlink();
|
||||||
|
|
||||||
var result = Subject.TransferFile(_sourcePath, _targetPath, TransferMode.Move);
|
var result = Subject.TransferFile(_sourcePath, _targetPath, TransferMode.Move);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.EnsureThat;
|
using NzbDrone.Common.EnsureThat;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Disk
|
namespace NzbDrone.Common.Disk
|
||||||
@ -34,6 +35,13 @@ public TransferMode TransferFolder(String sourcePath, String targetPath, Transfe
|
|||||||
Ensure.That(sourcePath, () => sourcePath).IsValidPath();
|
Ensure.That(sourcePath, () => sourcePath).IsValidPath();
|
||||||
Ensure.That(targetPath, () => targetPath).IsValidPath();
|
Ensure.That(targetPath, () => targetPath).IsValidPath();
|
||||||
|
|
||||||
|
if (OsInfo.IsWindows)
|
||||||
|
{
|
||||||
|
// TODO: Atm we haven't seen partial transfers on windows so we disable verified transfer.
|
||||||
|
// (If enabled in the future, be sure to check specifically for ReFS, which doesn't support hardlinks.)
|
||||||
|
verified = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_diskProvider.FolderExists(targetPath))
|
if (!_diskProvider.FolderExists(targetPath))
|
||||||
{
|
{
|
||||||
_diskProvider.CreateFolder(targetPath);
|
_diskProvider.CreateFolder(targetPath);
|
||||||
@ -66,6 +74,13 @@ public TransferMode TransferFile(String sourcePath, String targetPath, TransferM
|
|||||||
Ensure.That(sourcePath, () => sourcePath).IsValidPath();
|
Ensure.That(sourcePath, () => sourcePath).IsValidPath();
|
||||||
Ensure.That(targetPath, () => targetPath).IsValidPath();
|
Ensure.That(targetPath, () => targetPath).IsValidPath();
|
||||||
|
|
||||||
|
if (OsInfo.IsWindows)
|
||||||
|
{
|
||||||
|
// TODO: Atm we haven't seen partial transfers on windows so we disable verified transfer.
|
||||||
|
// (If enabled in the future, be sure to check specifically for ReFS, which doesn't support hardlinks.)
|
||||||
|
verified = false;
|
||||||
|
}
|
||||||
|
|
||||||
_logger.Debug("{0} [{1}] > [{2}]", mode, sourcePath, targetPath);
|
_logger.Debug("{0} [{1}] > [{2}]", mode, sourcePath, targetPath);
|
||||||
|
|
||||||
if (sourcePath.PathEquals(targetPath))
|
if (sourcePath.PathEquals(targetPath))
|
||||||
|
Loading…
Reference in New Issue
Block a user