Skip to content

Commit

Permalink
fix: disallow unclaimed space assignment when host drive is filtered
Browse files Browse the repository at this point in the history
  • Loading branch information
MauriceNino committed Mar 2, 2023
1 parent 5014f09 commit 997cec6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
2 changes: 2 additions & 0 deletions apps/api/__TESTS__/dynamic-info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const toStorageInp = (inp: TestCase) =>
describe('Dynamic Info', () => {
beforeEach(() => {
CONFIG.running_in_docker = true;
CONFIG.fs_device_filter = [];
});

describe('Storage', () => {
Expand Down Expand Up @@ -146,6 +147,7 @@ describe('Dynamic Info', () => {
expect(output).to.deep.equal(TEST_CASE_18.output);
});
it('Test Case 19', () => {
CONFIG.fs_device_filter = ['sda'];
const output = new DynamicStorageMapper(
false,
...toStorageInp(TEST_CASE_19)
Expand Down
2 changes: 2 additions & 0 deletions apps/api/__TESTS__/static-info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const toStorageInp = (inp: TestCase) =>
describe('Static Info', () => {
beforeEach(() => {
CONFIG.running_in_docker = true;
CONFIG.fs_device_filter = [];
});

describe('Storage', () => {
Expand Down Expand Up @@ -98,6 +99,7 @@ describe('Static Info', () => {
expect(output).to.deep.equal(TEST_CASE_18.layout);
});
it('Test Case 19', () => {
CONFIG.fs_device_filter = ['sda'];
const output = mapToStorageLayout(false, ...toStorageInp(TEST_CASE_19));
expect(output).to.deep.equal(TEST_CASE_19.layout);
});
Expand Down
8 changes: 2 additions & 6 deletions apps/api/__TESTS__/test-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6150,10 +6150,6 @@ export const TEST_CASE_19 = {
},
],
layout: [
{
size: 15502147584,
disks: [{ device: 'sda', brand: 'Kingston', type: 'HD' }],
},
{
size: 480103981056,
disks: [{ device: 'sdb', brand: 'Kingston Technology', type: 'SSD' }],
Expand Down Expand Up @@ -6196,7 +6192,7 @@ export const TEST_CASE_19 = {
},
],
output: [
680329216, 129046470656, 462745698304, 6725234688, 11663760277504, 0,
7385656987648, 3930067537920, 2526756556800, 3755402776576, 3789034754048,
129046470656, 462745698304, 6725234688, 11663760277504, 0, 7385656987648,
3930067537920, 2526756556800, 3755402776576, 3789034754048,
],
} as any as TestCase;
3 changes: 2 additions & 1 deletion apps/api/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export const CONFIG: Config = {
speed_test_from_path: penv('SPEED_TEST_FROM_PATH'),
fs_device_filter: lst(penv('FS_DEVICE_FILTER') ?? ''),
fs_type_filter: lst(
penv('FS_TYPE_FILTER') ?? 'cifs,9p,fuse.rclone,fuse.mergerfs,nfs4,iso9660'
penv('FS_TYPE_FILTER') ??
'cifs,9p,fuse.rclone,fuse.mergerfs,nfs4,iso9660,fuse.shfs'
),
fs_virtual_mounts: lst(penv('FS_VIRTUAL_MOUNTS') ?? ''),
disable_integrations: penv('DISABLE_INTEGRATIONS') === 'true',
Expand Down
6 changes: 1 addition & 5 deletions apps/api/src/data/storage/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ export class DynamicStorageMapper {
}

private getHasExplicitHost() {
return this.layout.some(({ disks, raidName }) =>
this.getIsExplicitHost(
this.getBlocksForDisks(disks).concat(this.getBlocksForRaid(raidName))
)
);
return this.getIsExplicitHost(this.validBlocks);
}

// Helpers
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/config/features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,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`
- default: `cifs,9p,fuse.rclone,fuse.mergerfs,nfs4,iso9660,fuse.shfs`

## `DASHDOT_FS_VIRTUAL_MOUNTS`

Expand Down

0 comments on commit 997cec6

Please sign in to comment.