@@ -21,15 +21,15 @@ describe("#plugin", function() {
2121 } ) ;
2222
2323 describe ( "#install" , function ( ) {
24+ var installed = false ;
2425
2526 it ( "should get plugin privileges" , function ( done ) {
2627 this . timeout ( 15000 ) ;
27- var plugin = docker . getPlugin ( 'sshfs' , ' vieux/sshfs') ;
28+ var plugin = docker . getPlugin ( 'vieux/sshfs' ) ;
2829
2930 function handler ( err , data ) {
3031 expect ( err ) . to . be . null ;
3132 expect ( data ) . to . be . a ( 'array' ) ;
32- console . log ( data ) ;
3333 done ( ) ;
3434 }
3535
@@ -42,35 +42,31 @@ describe("#plugin", function() {
4242 var plugin = docker . getPlugin ( 'sshfs' ) ;
4343
4444 //geezzz url, querystring and body...
45- plugin . install ( {
45+ plugin . pull ( {
4646 '_query' : {
4747 'remote' : 'vieux/sshfs'
4848 } ,
4949 '_body' : [ {
50- 'Name' : 'network' ,
51- 'Description' : '' ,
52- 'Value' : [
53- 'host'
54- ]
55- } , {
56- 'Name' : 'capabilities' ,
57- 'Description' : '' ,
58- 'Value' : [
59- 'CAP_SYS_ADMIN'
60- ]
61- } , {
62- 'Name' : 'mount' ,
63- 'Description' : '' ,
64- 'Value' : [
65- '/var/lib/docker/plugins/'
66- ]
67- } , {
68- 'Name' : 'device' ,
69- 'Description' : '' ,
70- 'Value' : [
71- '/dev/fuse'
72- ]
73- } ]
50+ 'Name' : 'network' ,
51+ 'Description' : 'permissions to access a network' ,
52+ 'Value' : [ 'host' ]
53+ } ,
54+ {
55+ 'Name' : 'mount' ,
56+ 'Description' : 'host path to mount' ,
57+ 'Value' : [ '/var/lib/docker/plugins/' ]
58+ } ,
59+ {
60+ 'Name' : 'device' ,
61+ 'Description' : 'host device to access' ,
62+ 'Value' : [ '/dev/fuse' ]
63+ } ,
64+ {
65+ 'Name' : 'capabilities' ,
66+ 'Description' : 'list of additional capabilities required' ,
67+ 'Value' : [ 'CAP_SYS_ADMIN' ]
68+ }
69+ ]
7470 } , function ( err , stream ) {
7571 if ( err ) return done ( err ) ;
7672 stream . pipe ( process . stdout ) ;
@@ -86,19 +82,26 @@ describe("#plugin", function() {
8682 function handler ( err , data ) {
8783 expect ( err ) . to . be . null ;
8884 expect ( data ) . to . be . ok ;
85+ installed = true ;
8986 done ( ) ;
9087 }
9188
92- plugin . enable ( handler ) ;
89+ plugin . enable ( {
90+ 'Timeout' : 5
91+ } , handler ) ;
9392 } ) ;
9493
9594 it ( "should disable a plugin" , function ( done ) {
9695 this . timeout ( 15000 ) ;
9796 var plugin = docker . getPlugin ( 'sshfs' ) ;
9897
9998 function handler ( err , data ) {
100- expect ( err ) . to . be . null ;
101- expect ( data ) . to . be . ok ;
99+ if ( installed === true ) {
100+ expect ( err ) . to . be . null ;
101+ expect ( data ) . to . be . ok ;
102+ } else {
103+ expect ( err ) . to . be . ok ;
104+ }
102105 done ( ) ;
103106 }
104107
@@ -111,11 +114,12 @@ describe("#plugin", function() {
111114
112115 function handler ( err , data ) {
113116 expect ( err ) . to . be . null ;
114- expect ( data ) . to . be . ok ;
117+ expect ( data ) . to . be . empty ;
115118 done ( ) ;
116119 }
117120
118121 plugin . remove ( handler ) ;
119122 } ) ;
123+
120124 } ) ;
121125} ) ;
0 commit comments