Skip to content

Commit

Permalink
ping endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
apocas committed Jun 9, 2014
1 parent 37b2b20 commit 58bf3c1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,26 @@ Docker.prototype.version = function(callback) {
});
};

Docker.prototype.ping = function(callback) {
if (!callback && typeof(opts) === 'function') {
callback = opts;
opts = null;
}

var optsf = {
path: '/_ping',
method: 'GET',
statusCodes: {
200: true,
500: "server error"
}
};

this.modem.dial(optsf, function(err, data) {
callback(err, data);
});
};

Docker.prototype.getEvents = function(opts, callback) {
if (!callback && typeof(opts) === 'function') {
callback = opts;
Expand Down
13 changes: 13 additions & 0 deletions test/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ describe("#docker", function() {
});
});

describe("#getPing", function() {
it("should ping server", function(done) {
this.timeout(30000);

function handler(err, data) {
expect(err).to.be.null;
done();
}

docker.ping(handler);
});
});

describe('#pull', function() {
this.timeout(120000);

Expand Down

0 comments on commit 58bf3c1

Please sign in to comment.