|
|
@ -21,15 +21,37 @@ namespace NzbDrone.Common.Test.DiskTests
|
|
|
|
private readonly string _tempTargetPath = @"C:\target\my.video.mkv.partial~".AsOsAgnostic();
|
|
|
|
private readonly string _tempTargetPath = @"C:\target\my.video.mkv.partial~".AsOsAgnostic();
|
|
|
|
private readonly string _nfsFile = ".nfs01231232";
|
|
|
|
private readonly string _nfsFile = ".nfs01231232";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private MockMount _sourceMount;
|
|
|
|
|
|
|
|
private MockMount _targetMount;
|
|
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
[SetUp]
|
|
|
|
public void SetUp()
|
|
|
|
public void SetUp()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<IDiskProvider>(MockBehavior.Strict);
|
|
|
|
Mocker.GetMock<IDiskProvider>(MockBehavior.Strict);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_sourceMount = new MockMount()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Name = "source",
|
|
|
|
|
|
|
|
RootDirectory = @"C:\source".AsOsAgnostic()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
_targetMount = new MockMount()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Name = "target",
|
|
|
|
|
|
|
|
RootDirectory = @"C:\target".AsOsAgnostic()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
.Setup(v => v.GetMount(It.IsAny<string>()))
|
|
|
|
.Setup(v => v.GetMount(It.IsAny<string>()))
|
|
|
|
.Returns((IMount)null);
|
|
|
|
.Returns((IMount)null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
|
|
|
|
.Setup(v => v.GetMount(It.Is<string>(p => p.StartsWith(_sourceMount.RootDirectory))))
|
|
|
|
|
|
|
|
.Returns(_sourceMount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
|
|
|
|
.Setup(v => v.GetMount(It.Is<string>(p => p.StartsWith(_targetMount.RootDirectory))))
|
|
|
|
|
|
|
|
.Returns(_targetMount);
|
|
|
|
|
|
|
|
|
|
|
|
WithEmulatedDiskProvider();
|
|
|
|
WithEmulatedDiskProvider();
|
|
|
|
|
|
|
|
|
|
|
|
WithExistingFile(_sourcePath);
|
|
|
|
WithExistingFile(_sourcePath);
|
|
|
@ -59,6 +81,27 @@ namespace NzbDrone.Common.Test.DiskTests
|
|
|
|
.Verify(v => v.MoveFile(_sourcePath, _targetPath, false), Times.Once());
|
|
|
|
.Verify(v => v.MoveFile(_sourcePath, _targetPath, false), Times.Once());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[TestCase("fuse.mergerfs")]
|
|
|
|
|
|
|
|
[TestCase("fuse.rclone")]
|
|
|
|
|
|
|
|
[TestCase("mergerfs")]
|
|
|
|
|
|
|
|
[TestCase("rclone")]
|
|
|
|
|
|
|
|
public void should_not_use_verified_transfer_on_specific_filesystems(string fs)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MonoOnly();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_targetMount.DriveFormat = fs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.VerificationMode.Should().Be(DiskTransferVerificationMode.VerifyOnly);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_throw_if_path_is_the_same()
|
|
|
|
public void should_throw_if_path_is_the_same()
|
|
|
|
{
|
|
|
|
{
|
|
|
|