mirror of https://github.com/lidarr/Lidarr
Fixed: Add Unittest for DiskSpaceService irrelevant mounts
This commit is contained in:
parent
fe4499ee97
commit
25f08bd846
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace NzbDrone.Common.Disk
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (VolumeLabel.IsNullOrWhiteSpace())
|
if (VolumeLabel.IsNullOrWhiteSpace() || VolumeLabel.StartsWith("UUID=") || Name == VolumeLabel)
|
||||||
{
|
{
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,5 +99,25 @@ namespace NzbDrone.Core.Test.DiskSpace
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Verify(v => v.GetAvailableSpace(It.IsAny<string>()), Times.Never());
|
.Verify(v => v.GetAvailableSpace(It.IsAny<string>()), Times.Never());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("/boot")]
|
||||||
|
[TestCase("/var/lib/rancher")]
|
||||||
|
[TestCase("/var/lib/kubelet")]
|
||||||
|
[TestCase("/var/lib/docker")]
|
||||||
|
[TestCase("/some/place/docker/aufs")]
|
||||||
|
public void should_not_check_diskspace_for_irrelevant_mounts(string path)
|
||||||
|
{
|
||||||
|
var mount = new Mock<IMount>();
|
||||||
|
mount.SetupGet(v => v.RootDirectory).Returns(path);
|
||||||
|
mount.SetupGet(v => v.DriveType).Returns(System.IO.DriveType.Fixed);
|
||||||
|
|
||||||
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
.Setup(v => v.GetMounts())
|
||||||
|
.Returns(new List<IMount> { mount.Object });
|
||||||
|
|
||||||
|
var freeSpace = Subject.GetFreeSpace();
|
||||||
|
|
||||||
|
freeSpace.Should().BeEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Mono.Unix;
|
using Mono.Unix;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
|
@ -45,7 +45,7 @@ namespace NzbDrone.Mono.Disk
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (VolumeLabel.IsNullOrWhiteSpace() || VolumeLabel.StartsWith("UUID="))
|
if (VolumeLabel.IsNullOrWhiteSpace() || VolumeLabel.StartsWith("UUID=") || Name == VolumeLabel)
|
||||||
{
|
{
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue