@@ -38,6 +38,35 @@ describe('Cp', () => {
38
38
await cp . cpFromPod ( namespace , pod , container , srcPath , tgtPath ) ;
39
39
verify ( fakeWebSocket . connect ( `${ path } ?${ queryStr } ` , null , anyFunction ( ) ) ) . called ( ) ;
40
40
} ) ;
41
+
42
+ it ( 'should run create tar command to a url with cwd' , async ( ) => {
43
+ const kc = new KubeConfig ( ) ;
44
+ const fakeWebSocket : WebSocketInterface = mock ( WebSocketHandler ) ;
45
+ const exec = new Exec ( kc , instance ( fakeWebSocket ) ) ;
46
+ const cp = new Cp ( kc , exec ) ;
47
+
48
+ const namespace = 'somenamespace' ;
49
+ const pod = 'somepod' ;
50
+ const container = 'container' ;
51
+ const srcPath = '/' ;
52
+ const tgtPath = '/' ;
53
+ const cwd = '/abc' ;
54
+ const cmdArray = [ 'tar' , 'zcf' , '-' , '-C' , cwd , srcPath ] ;
55
+ const path = `/api/v1/namespaces/${ namespace } /pods/${ pod } /exec` ;
56
+
57
+ const query = {
58
+ stdout : true ,
59
+ stderr : true ,
60
+ stdin : false ,
61
+ tty : false ,
62
+ command : cmdArray ,
63
+ container,
64
+ } ;
65
+ const queryStr = querystring . stringify ( query ) ;
66
+
67
+ await cp . cpFromPod ( namespace , pod , container , srcPath , tgtPath , cwd ) ;
68
+ verify ( fakeWebSocket . connect ( `${ path } ?${ queryStr } ` , null , anyFunction ( ) ) ) . called ( ) ;
69
+ } ) ;
41
70
} ) ;
42
71
43
72
describe ( 'cpToPod' , ( ) => {
0 commit comments