2016-01-25 16:03:12 -08:00
|
|
|
/* jslint node:true */
|
|
|
|
|
/* global it:false */
|
|
|
|
|
/* global describe:false */
|
|
|
|
|
/* global before:false */
|
|
|
|
|
/* global after:false */
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2021-06-03 12:20:44 -07:00
|
|
|
const common = require('./common.js'),
|
2019-11-21 12:58:06 -08:00
|
|
|
expect = require('expect.js'),
|
|
|
|
|
system = require('../system.js');
|
2016-01-25 16:03:12 -08:00
|
|
|
|
2019-11-21 12:58:06 -08:00
|
|
|
describe('System', function () {
|
2021-08-13 10:41:10 -07:00
|
|
|
const { setup, cleanup } = common;
|
|
|
|
|
|
|
|
|
|
before(setup);
|
|
|
|
|
after(cleanup);
|
2016-01-25 16:03:12 -08:00
|
|
|
|
2021-08-25 19:41:46 -07:00
|
|
|
it('can get disks', async function () {
|
2021-09-16 15:20:26 +02:00
|
|
|
// does not work on archlinux 8!
|
|
|
|
|
if (require('child_process').execSync('uname -a').toString().indexOf('-arch') !== -1) return;
|
|
|
|
|
|
2021-08-25 19:41:46 -07:00
|
|
|
const disks = await system.getDisks();
|
|
|
|
|
expect(disks).to.be.ok();
|
2022-10-18 19:32:07 +02:00
|
|
|
expect(disks.some(d => d.mountpoint === '/')).to.be.ok();
|
2019-08-19 13:50:44 -07:00
|
|
|
});
|
|
|
|
|
|
2021-08-25 19:41:46 -07:00
|
|
|
it('can check for disk space', async function () {
|
2021-09-16 15:20:26 +02:00
|
|
|
// does not work on archlinux 8!
|
|
|
|
|
if (require('child_process').execSync('uname -a').toString().indexOf('-arch') !== -1) return;
|
|
|
|
|
|
2021-08-25 19:41:46 -07:00
|
|
|
await system.checkDiskSpace();
|
2016-01-25 16:03:12 -08:00
|
|
|
});
|
2019-11-21 12:58:06 -08:00
|
|
|
|
2021-08-25 19:41:46 -07:00
|
|
|
it('can get memory', async function () {
|
|
|
|
|
const memory = await system.getMemory();
|
|
|
|
|
expect(memory.memory).to.be.a('number');
|
|
|
|
|
expect(memory.swap).to.be.a('number');
|
2019-11-21 12:58:06 -08:00
|
|
|
});
|
2022-10-11 22:58:12 +02:00
|
|
|
|
2022-10-12 10:30:02 +02:00
|
|
|
it('can get diskUsage', async function () {
|
|
|
|
|
const usage = await system.getDiskUsage();
|
|
|
|
|
expect(usage).to.be(null); // nothing cached
|
2022-10-11 22:58:12 +02:00
|
|
|
});
|
2016-01-25 16:03:12 -08:00
|
|
|
});
|