diff --git a/src/system.js b/src/system.js index 6a9daf115..fda9ee84c 100644 --- a/src/system.js +++ b/src/system.js @@ -4,7 +4,6 @@ exports = module.exports = { reboot, getInfo, getUbuntuVersion, - getDisks, getSwaps, checkDiskSpace, getMemory, @@ -16,6 +15,9 @@ exports = module.exports = { runSystemChecks, getProvider, getCpus, + + // exported for testing + _getDisks: getDisks }; const apps = require('./apps.js'), @@ -87,6 +89,7 @@ async function getSwaps() { return swaps; } +// this gets information based on mounted filesystems async function getDisks() { const [dfError, dfEntries] = await safe(df.disks()); if (dfError) throw new BoxError(BoxError.FS_ERROR, `Error running df: ${dfError.message}`); @@ -313,6 +316,7 @@ async function getLogs(unit, options) { return logStream; } +// this gets block devices as opposed to mounted filesystems. this is used for configuring backups and volumes in the frontend async function getBlockDevices() { const result = await shell.spawn('lsblk', ['--paths', '--json', '--list', '--fs', '--output', '+rota'], { encoding: 'utf8' }); const info = safe.JSON.parse(result); diff --git a/src/test/system-test.js b/src/test/system-test.js index b2034424a..b3ccda69a 100644 --- a/src/test/system-test.js +++ b/src/test/system-test.js @@ -20,7 +20,7 @@ describe('System', function () { // does not work on archlinux 8! if (require('child_process').execSync('uname -a').toString().indexOf('-arch') !== -1) return; - const disks = await system.getDisks(); + const disks = await system._getDisks(); expect(disks).to.be.ok(); expect(Object.keys(disks).some(fs => disks[fs].mountpoint === '/')).to.be.ok(); });