File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,26 @@ Docker.prototype.version = function(callback) {
197197 } ) ;
198198} ;
199199
200+ Docker . prototype . ping = function ( callback ) {
201+ if ( ! callback && typeof ( opts ) === 'function' ) {
202+ callback = opts ;
203+ opts = null ;
204+ }
205+
206+ var optsf = {
207+ path : '/_ping' ,
208+ method : 'GET' ,
209+ statusCodes : {
210+ 200 : true ,
211+ 500 : "server error"
212+ }
213+ } ;
214+
215+ this . modem . dial ( optsf , function ( err , data ) {
216+ callback ( err , data ) ;
217+ } ) ;
218+ } ;
219+
200220Docker . prototype . getEvents = function ( opts , callback ) {
201221 if ( ! callback && typeof ( opts ) === 'function' ) {
202222 callback = opts ;
Original file line number Diff line number Diff line change @@ -68,6 +68,19 @@ describe("#docker", function() {
6868 } ) ;
6969 } ) ;
7070
71+ describe ( "#getPing" , function ( ) {
72+ it ( "should ping server" , function ( done ) {
73+ this . timeout ( 30000 ) ;
74+
75+ function handler ( err , data ) {
76+ expect ( err ) . to . be . null ;
77+ done ( ) ;
78+ }
79+
80+ docker . ping ( handler ) ;
81+ } ) ;
82+ } ) ;
83+
7184 describe ( '#pull' , function ( ) {
7285 this . timeout ( 120000 ) ;
7386
You can’t perform that action at this time.
0 commit comments