tasks: remove auditSource from start/stop

This commit is contained in:
Girish Ramakrishnan
2018-12-11 09:22:13 -08:00
parent ee609c8ef0
commit c7da090882
6 changed files with 14 additions and 20 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ function auditSource(req) {
function stopTask(req, res, next) {
assert.strictEqual(typeof req.params.taskId, 'string');
tasks.stopTask(req.params.taskId, auditSource(req), function (error) {
tasks.stopTask(req.params.taskId, function (error) {
if (error && error.reason === TaskError.NOT_FOUND) return next(new HttpError(404, 'No such task'));
if (error && error.reason === TaskError.BAD_STATE) return next(new HttpError(409, error.message));
if (error) return next(new HttpError(500, error));
+4 -6
View File
@@ -53,15 +53,13 @@ function cleanup(done) {
});
}
let AUDIT_SOURCE = { ip: '1.2.3.4' };
describe('Tasks API', function () {
before(setup);
after(cleanup);
it('can get task', function (done) {
let taskId = null;
let task = tasks.startTask(tasks._TASK_IDENTITY, [ 'ping' ], AUDIT_SOURCE);
let task = tasks.startTask(tasks._TASK_IDENTITY, [ 'ping' ]);
task.on('error', done);
task.on('start', (tid) => { taskId = tid; });
@@ -81,7 +79,7 @@ describe('Tasks API', function () {
it('can get logs', function (done) {
let taskId = null;
let task = tasks.startTask(tasks._TASK_CRASH, [ 'ping' ], AUDIT_SOURCE);
let task = tasks.startTask(tasks._TASK_CRASH, [ 'ping' ]);
task.on('error', done);
task.on('start', (tid) => { taskId = tid; });
@@ -97,7 +95,7 @@ describe('Tasks API', function () {
it('cannot stop inactive task', function (done) {
let taskId = null;
let task = tasks.startTask(tasks._TASK_IDENTITY, [ 'ping' ], AUDIT_SOURCE);
let task = tasks.startTask(tasks._TASK_IDENTITY, [ 'ping' ]);
task.on('error', done);
task.on('start', (tid) => { taskId = tid; });
@@ -114,7 +112,7 @@ describe('Tasks API', function () {
it('can stop task', function (done) {
let taskId = null;
let task = tasks.startTask(tasks._TASK_SLEEP, [ 10000 ], AUDIT_SOURCE);
let task = tasks.startTask(tasks._TASK_SLEEP, [ 10000 ]);
task.on('error', done);
task.on('start', (tid) => {
taskId = tid;