Skip to content

Commit

Permalink
fix: filter out autofs from sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
MauriceNino committed Jan 23, 2024
1 parent 0d6838c commit f7ac272
Show file tree
Hide file tree
Showing 6 changed files with 357 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apps/docs/docs/configuration/storage.mdx
Expand Up @@ -61,7 +61,7 @@ Please also create a [bug ticket](https://github.com/MauriceNino/dashdot/issues/
repository though, so that we can fix this problem for everyone.

- type: `string (comma separated list)`
- default: `cifs,9p,fuse.rclone,fuse.mergerfs,nfs4,iso9660,fuse.shfs`
- default: `cifs,9p,fuse.rclone,fuse.mergerfs,nfs4,iso9660,fuse.shfs,autofs`

### `DASHDOT_FS_VIRTUAL_MOUNTS`

Expand Down
8 changes: 8 additions & 0 deletions apps/server/__TESTS__/dynamic-info.test.ts
Expand Up @@ -14,6 +14,7 @@ import {
TEST_CASE_23,
TEST_CASE_24,
TEST_CASE_25,
TEST_CASE_26,
TestCase,
} from './test-cases';

Expand Down Expand Up @@ -114,5 +115,12 @@ describe('Dynamic Info', () => {
).getMappedLayout();
expect(output).to.deep.equal(TEST_CASE_25.output);
});
it('Test Case 26', () => {
const output = new DynamicStorageMapper(
false,
...toStorageInp(TEST_CASE_26)
).getMappedLayout();
expect(output).to.deep.equal(TEST_CASE_26.output);
});
});
});
5 changes: 5 additions & 0 deletions apps/server/__TESTS__/static-info.test.ts
Expand Up @@ -14,6 +14,7 @@ import {
TEST_CASE_23,
TEST_CASE_24,
TEST_CASE_25,
TEST_CASE_26,
TestCase,
} from './test-cases';

Expand Down Expand Up @@ -79,5 +80,9 @@ describe('Static Info', () => {
const output = mapToStorageLayout(false, ...toStorageInp(TEST_CASE_25));
expect(output).to.deep.equal(TEST_CASE_25.layout);
});
it('Test Case 26', () => {
const output = mapToStorageLayout(false, ...toStorageInp(TEST_CASE_26));
expect(output).to.deep.equal(TEST_CASE_26.layout);
});
});
});
340 changes: 340 additions & 0 deletions apps/server/__TESTS__/test-cases.ts
Expand Up @@ -4322,3 +4322,343 @@ export const TEST_CASE_25 = {
],
output: [42625843200, 762590027776],
} as any as TestCase;

// Test case from home server (with external disk)
export const TEST_CASE_26 = {
disks: [
{
device: '/dev/sda',
type: 'HD',
name: 'Portable ',
vendor: 'Seagate',
size: 4000787029504,
bytesPerSector: null,
totalCylinders: null,
totalHeads: null,
totalSectors: null,
totalTracks: null,
tracksPerCylinder: null,
sectorsPerTrack: null,
firmwareRevision: '0712',
serialNum: '',
interfaceType: 'USB',
smartStatus: 'unknown',
temperature: null,
},
{
device: '/dev/nvme0n1',
type: 'NVMe',
name: 'PCIe SSD ',
vendor: '',
size: 512110190592,
bytesPerSector: null,
totalCylinders: null,
totalHeads: null,
totalSectors: null,
totalTracks: null,
tracksPerCylinder: null,
sectorsPerTrack: null,
firmwareRevision: '',
serialNum: '7FBC07390DD900365059',
interfaceType: 'PCIe',
smartStatus: 'unknown',
temperature: null,
},
],
sizes: [
{
fs: 'overlay',
type: 'overlay',
size: 105089261568,
used: 41106567168,
available: 58597208064,
use: 41.23,
mount: '/',
rw: false,
},
{
fs: '/dev/mapper/ubuntu--vg-ubuntu--lv',
type: 'ext4',
size: 105089261568,
used: 41106567168,
available: 58597208064,
use: 41.23,
mount: '/mnt/host',
rw: true,
},
{
fs: 'efivarfs',
type: 'efivarfs',
size: 196608,
used: 92160,
available: 99328,
use: 48.13,
mount: '/mnt/host/sys/firmware/efi/efivars',
rw: false,
},
{
fs: '/dev/loop0',
type: 'squashfs',
size: 66584576,
used: 66584576,
available: 0,
use: 100,
mount: '/mnt/host/snap/core20/1974',
rw: false,
},
{
fs: '/dev/loop1',
type: 'squashfs',
size: 67108864,
used: 67108864,
available: 0,
use: 100,
mount: '/mnt/host/snap/core20/2105',
rw: false,
},
{
fs: '/dev/loop2',
type: 'squashfs',
size: 117440512,
used: 117440512,
available: 0,
use: 100,
mount: '/mnt/host/snap/lxd/24322',
rw: false,
},
{
fs: '/dev/loop3',
type: 'squashfs',
size: 55967744,
used: 55967744,
available: 0,
use: 100,
mount: '/mnt/host/snap/snapd/19457',
rw: false,
},
{
fs: '/dev/loop4',
type: 'squashfs',
size: 42467328,
used: 42467328,
available: 0,
use: 100,
mount: '/mnt/host/snap/snapd/20671',
rw: false,
},
{
fs: '/dev/nvme0n1p2',
type: 'ext4',
size: 2040373248,
used: 284254208,
available: 1631969280,
use: 14.83,
mount: '/mnt/host/boot',
rw: false,
},
{
fs: '/dev/nvme0n1p1',
type: 'vfat',
size: 1124999168,
used: 6369280,
available: 1118629888,
use: 0.57,
mount: '/mnt/host/boot/efi',
rw: false,
},
{
fs: '/dev/sda1',
type: 'ext4',
size: 3936820690944,
used: 1772756307968,
available: 1964008259584,
use: 47.44,
mount: '/mnt/host/mnt/media',
rw: false,
},
],
blocks: [
{
name: 'nvme0n1',
type: 'disk',
fsType: '',
mount: '',
size: 512110190592,
physical: 'SSD',
uuid: '',
label: '',
model: 'PCIe SSD',
serial: '7FBC07390DD900365059',
removable: false,
protocol: 'nvme',
group: '',
device: '/dev/nvme0n1',
},
{
name: 'sda',
type: 'disk',
fsType: '',
mount: '',
size: 4000787029504,
physical: 'HDD',
uuid: '',
label: '',
model: 'Portable',
serial: '',
removable: false,
protocol: 'usb',
group: '',
device: '/dev/sda',
},
{
name: 'loop0',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/core20/1974',
size: 66531328,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: '',
},
{
name: 'loop1',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/core20/2105',
size: 67014656,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: '',
},
{
name: 'loop2',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/lxd/24322',
size: 117387264,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: '',
},
{
name: 'loop3',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/snapd/19457',
size: 55844864,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: '',
},
{
name: 'loop4',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/snapd/20671',
size: 42393600,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: '',
},
{
name: 'nvme0n1p1',
type: 'part',
fsType: 'vfat',
mount: '/mnt/host/boot/efi',
size: 1127219200,
physical: '',
uuid: '060E-D169',
label: '',
model: '',
serial: '',
removable: false,
protocol: 'nvme',
group: '',
device: '/dev/nvme0n1',
},
{
name: 'nvme0n1p2',
type: 'part',
fsType: 'ext4',
mount: '/mnt/host/boot',
size: 2147483648,
physical: '',
uuid: 'dc87bf05-b396-43cb-a967-063d9a4c0466',
label: '',
model: '',
serial: '',
removable: false,
protocol: 'nvme',
group: '',
device: '/dev/nvme0n1',
},
{
name: 'nvme0n1p3',
type: 'part',
fsType: 'LVM2_member',
mount: '',
size: 508833038336,
physical: '',
uuid: 'YVRqdg-O2wM-Xt1P-u9mk-wtWW-7G56-S5ZFKR',
label: '',
model: '',
serial: '',
removable: false,
protocol: 'nvme',
group: '',
device: '/dev/nvme0n1',
},
{
name: 'sda1',
type: 'part',
fsType: 'ext4',
mount: '/mnt/host/mnt/media',
size: 4000786992128,
physical: '',
uuid: '4a38cee0-e843-46a9-bcc4-7fdd8b29a11a',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: '',
device: '/dev/sda',
},
],
layout: [
{
disks: [{ brand: '', device: 'nvme0n1', type: 'NVMe' }],
size: 512110190592,
},
{
disks: [{ brand: 'Seagate', device: 'sda', type: 'HD' }],
size: 4000787029504,
},
],
output: [41397190656, 1836722646528],
} as any as TestCase;

0 comments on commit f7ac272

Please sign in to comment.