mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-27 00:02:25 +00:00
Fixed: Add Unittest for DiskSpaceService irrelevant mounts
This commit is contained in:
parent
fe4499ee97
commit
25f08bd846
3 changed files with 24 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public string VolumeName
|
|||
{
|
||||
get
|
||||
{
|
||||
if (VolumeLabel.IsNullOrWhiteSpace())
|
||||
if (VolumeLabel.IsNullOrWhiteSpace() || VolumeLabel.StartsWith("UUID=") || Name == VolumeLabel)
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
|
|
@ -99,5 +99,25 @@ public void should_not_check_diskspace_for_missing_artist_folders()
|
|||
Mocker.GetMock<IDiskProvider>()
|
||||
.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 Mono.Unix;
|
||||
using NzbDrone.Common.Disk;
|
||||
|
@ -45,7 +45,7 @@ public string VolumeName
|
|||
{
|
||||
get
|
||||
{
|
||||
if (VolumeLabel.IsNullOrWhiteSpace() || VolumeLabel.StartsWith("UUID="))
|
||||
if (VolumeLabel.IsNullOrWhiteSpace() || VolumeLabel.StartsWith("UUID=") || Name == VolumeLabel)
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue