Skip to content

Commit

Permalink
Seems like /leader was renamed /v1/stats/leader in etcd 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
stianeikeland committed Oct 13, 2013
1 parent 8d6b537 commit bb87298
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
6 changes: 3 additions & 3 deletions example.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ c.machines (err, val) ->
c.leader (err, val) ->
console.log err, val

# Statistics (leader and self)
c.statsLeader (err, val) -> console.log err, val
c.statsSelf (err, val) -> console.log err, val
# Statistics
c.stats (err, val) ->
console.log err, val


## SSL Support
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-etcd",
"version": "0.4.0",
"version": "0.4.1",
"description": "etcd library for node.js",
"licenses": [
{
Expand Down
9 changes: 2 additions & 7 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,13 @@ class Etcd
opt = @_prepareOpts "keys/_etcd/machines"
request.get opt, @_responseHandler callback

# Get the current cluster leader
# Get statistics about the cluster leader
leader: (callback) ->
opt = @_prepareOpts "leader", ""
request.get opt, @_responseHandler callback

# Get statistics about the leader
statsLeader: (callback) ->
opt = @_prepareOpts "stats/leader"
request.get opt, @_responseHandler callback

# Get statistics about the currently connected entity
statsSelf: (callback) ->
stats: (callback) ->
opt = @_prepareOpts "stats/self"
request.get opt, @_responseHandler callback

Expand Down
11 changes: 3 additions & 8 deletions test/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,13 @@ describe 'Basic functions', () ->

describe '#leader()', () ->
it 'should ask etcd for leader', (done) ->
getNock().get('/leader').reply(200, '{"value":"value"}')
etcd.leader checkVal done

describe '#statsLeader()', () ->
it 'should ask etcd for statistics for leader', (done) ->
getNock().get('/v1/stats/leader').reply(200, '{"value":"value"}')
etcd.statsLeader checkVal done
etcd.leader checkVal done

describe '#statsSelf()', () ->
describe '#self()', () ->
it 'should ask etcd for statistics for connected server', (done) ->
getNock().get('/v1/stats/self').reply(200, '{"value":"value"}')
etcd.statsSelf checkVal done
etcd.stats checkVal done

describe '#version()', () ->
it 'should ask etcd for version', (done) ->
Expand Down

0 comments on commit bb87298

Please sign in to comment.