Skip to content

Commit

Permalink
Integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
jwolski committed Sep 29, 2015
1 parent e37c1cf commit d862bdb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
12 changes: 12 additions & 0 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ RingpopClient.prototype.adminConfigSet = function adminConfigSet(host, body, cal
this._request(host, '/admin/config/set', null, body, callback);
};

RingpopClient.prototype.adminGossipStart = function adminGossipStart(host, callback) {
this._request(host, '/admin/gossip/start', null, null, callback);
};

RingpopClient.prototype.adminGossipStop = function adminGossipStop(host, callback) {
this._request(host, '/admin/gossip/stop', null, null, callback);
};

RingpopClient.prototype.adminGossipTick= function adminGossipTick(host, callback) {
this._request(host, '/admin/gossip/tick', null, null, callback);
};

RingpopClient.prototype.destroy = function destroy(callback) {
this.tchannel.close(callback);
};
Expand Down
27 changes: 27 additions & 0 deletions test/integration/admin_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,30 @@ testRingpopCluster({
client.destroy();
});
});

// Test to make sure these endpoints are available. Find tests that test
// behavior of handlers under unit tests.
testRingpopCluster({
size: 1
}, 'gossip endpoints', function t(bootRes, cluster, assert) {
assert.plan(4);

var client = new RingpopClient();
async.series([
adminGossip('adminGossipStart'),
adminGossip('adminGossipStop'),
adminGossip('adminGossipTick')
], function onSeries(err) {
assert.notok(err, 'no error occurred');
client.destroy();
});

function adminGossip(method) {
return function doIt(callback) {
client[method](cluster[0].whoami(), function onMethod(err) {
assert.notok(err, 'no error occurred');
callback();
});
};
}
});

0 comments on commit d862bdb

Please sign in to comment.