From d862bdb64afb811abf3a56e63f2a0a4850e07f12 Mon Sep 17 00:00:00 2001 From: Jeff Wolski Date: Sun, 13 Sep 2015 18:43:09 +0200 Subject: [PATCH] Integration test --- client.js | 12 ++++++++++++ test/integration/admin_test.js | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/client.js b/client.js index d17a4a32..fea1fb41 100644 --- a/client.js +++ b/client.js @@ -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); }; diff --git a/test/integration/admin_test.js b/test/integration/admin_test.js index 17bf124c..bef91647 100644 --- a/test/integration/admin_test.js +++ b/test/integration/admin_test.js @@ -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(); + }); + }; + } +});