system: cpu route
This commit is contained in:
@@ -11,6 +11,7 @@ exports = module.exports = {
|
||||
getLogStream,
|
||||
getSystemGraphs,
|
||||
getBlockDevices,
|
||||
getCpus
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
@@ -143,3 +144,10 @@ async function getBlockDevices(req, res, next) {
|
||||
|
||||
next(new HttpSuccess(200, { devices }));
|
||||
}
|
||||
|
||||
async function getCpus(req, res, next) {
|
||||
const [error, cpus] = await safe(system.getCpus());
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, { cpus }));
|
||||
}
|
||||
|
||||
@@ -21,6 +21,18 @@ describe('System', function () {
|
||||
before(setup);
|
||||
after(cleanup);
|
||||
|
||||
describe('cpus', function () {
|
||||
it('succeeds', async function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/system/cpus`)
|
||||
.query({ access_token: owner.token });
|
||||
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.body.cpus).to.be.ok();
|
||||
|
||||
expect(response.body.cpus.every(c => typeof c.model === 'string')).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('logs', function () {
|
||||
before(function () {
|
||||
console.log(paths.BOX_LOG_FILE);
|
||||
|
||||
Reference in New Issue
Block a user