Permalink
Browse files

[api test minor] Be more liberal handling errors on stop.

  • Loading branch information...
1 parent b09c66c commit f5203d793b4c3dc0ab7b656372b3d1da8398e6a1 @indexzero indexzero committed Mar 7, 2013
Showing with 4 additions and 10 deletions.
  1. +1 −1 lib/haibu/drone/drone.js
  2. +1 −2 lib/haibu/drone/service.js
  3. +2 −7 test/drone/drone-api-test.js
View
@@ -158,7 +158,7 @@ Drone.prototype.stop = function (name, cleanup, callback) {
}
if (typeof this.apps[name] === 'undefined') {
- return callback(new Error('Cannot stop application that is not running.'));
+ return callback();
}
var self = this,
@@ -144,8 +144,7 @@ exports.createRouter = function (drone) {
var res = this.res;
drone.stop(this.req.body.stop.name, function (err, result) {
- if (err || !result) {
- err = err || new Error('Unknown error from drone.');
+ if (err) {
haibu.emit('error:service', 'error', err);
return haibu.sendResponse(res, 500, { error: err });
}
@@ -279,13 +279,8 @@ vows.describe('haibu/drone/api').addBatch(
request(options, this.callback);
},
- "should respond with 500": function (error, response, body) {
- assert.equal(response.statusCode, 500);
- },
- "should respond with the appropriate error": function (error, response, body) {
- var result = JSON.parse(body);
- assert.isObject(result.error);
- assert.equal(result.error.message, 'Cannot stop application that is not running.');
+ "should respond with 200": function (error, response, body) {
+ assert.equal(response.statusCode, 200);
}
}
}

0 comments on commit f5203d7

Please sign in to comment.