Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit f5203d793b4c3dc0ab7b656372b3d1da8398e6a1 1 parent b09c66c
@indexzero indexzero authored
View
2  lib/haibu/drone/drone.js
@@ -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,
View
3  lib/haibu/drone/service.js
@@ -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 });
}
View
9 test/drone/drone-api-test.js
@@ -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);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.